Add option to disable removing avatars from Telegram ghosts
There's no way to determine whether an avatar is removed or just hidden from some users, so avatars are not removed by default.
This commit is contained in:
@@ -83,6 +83,7 @@ class Config(BaseBridgeConfig):
|
|||||||
|
|
||||||
copy("bridge.displayname_preference")
|
copy("bridge.displayname_preference")
|
||||||
copy("bridge.displayname_max_length")
|
copy("bridge.displayname_max_length")
|
||||||
|
copy("bridge.allow_avatar_remove")
|
||||||
|
|
||||||
copy("bridge.max_initial_member_sync")
|
copy("bridge.max_initial_member_sync")
|
||||||
copy("bridge.sync_channel_members")
|
copy("bridge.sync_channel_members")
|
||||||
|
|||||||
@@ -121,6 +121,10 @@ bridge:
|
|||||||
- phone number
|
- phone number
|
||||||
# Maximum length of displayname
|
# Maximum length of displayname
|
||||||
displayname_max_length: 100
|
displayname_max_length: 100
|
||||||
|
# Remove avatars from Telegram ghost users when removed on Telegram. This is disabled by default
|
||||||
|
# as there's no way to determine whether an avatar is removed or just hidden from some users. If
|
||||||
|
# you're on a single-user instance, this should be safe to enable.
|
||||||
|
allow_avatar_remove: false
|
||||||
|
|
||||||
# Maximum number of members to sync per portal when starting up. Other members will be
|
# Maximum number of members to sync per portal when starting up. Other members will be
|
||||||
# synced when they send messages. The maximum is 10000, after which the Telegram server
|
# synced when they send messages. The maximum is 10000, after which the Telegram server
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# mautrix-telegram - A Matrix-Telegram puppeting bridge
|
# mautrix-telegram - A Matrix-Telegram puppeting bridge
|
||||||
# Copyright (C) 2019 Tulir Asokan
|
# Copyright (C) 2020 Tulir Asokan
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Affero General Public License as published by
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
@@ -695,6 +695,8 @@ class PortalMetadata(BasePortal, ABC):
|
|||||||
loc = None
|
loc = None
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"Unknown photo type {type(photo)}")
|
raise ValueError(f"Unknown photo type {type(photo)}")
|
||||||
|
if self.peer_type == "user" and not photo_id and not config["bridge.allow_avatar_remove"]:
|
||||||
|
return False
|
||||||
if self.photo_id != photo_id:
|
if self.photo_id != photo_id:
|
||||||
if not photo_id:
|
if not photo_id:
|
||||||
await self._try_set_state(sender, EventType.ROOM_AVATAR,
|
await self._try_set_state(sender, EventType.ROOM_AVATAR,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# mautrix-telegram - A Matrix-Telegram puppeting bridge
|
# mautrix-telegram - A Matrix-Telegram puppeting bridge
|
||||||
# Copyright (C) 2019 Tulir Asokan
|
# Copyright (C) 2020 Tulir Asokan
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Affero General Public License as published by
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
@@ -300,6 +300,8 @@ class Puppet(CustomPuppetMixin):
|
|||||||
else:
|
else:
|
||||||
self.log.warning(f"Unknown user profile photo type: {type(photo)}")
|
self.log.warning(f"Unknown user profile photo type: {type(photo)}")
|
||||||
return False
|
return False
|
||||||
|
if not photo_id and not config["bridge.allow_avatar_remove"]:
|
||||||
|
return False
|
||||||
if self.photo_id != photo_id:
|
if self.photo_id != photo_id:
|
||||||
if not photo_id:
|
if not photo_id:
|
||||||
self.photo_id = ""
|
self.photo_id = ""
|
||||||
|
|||||||
Reference in New Issue
Block a user