Add option to disable startup sync. Fixes #176

This commit is contained in:
Tulir Asokan
2019-02-14 00:57:27 +02:00
parent c2172aa562
commit c31e0a50b5
3 changed files with 6 additions and 2 deletions
+3
View File
@@ -104,6 +104,9 @@ bridge:
# If no channel admins have logged into the bridge, the bridge won't be able to sync the member
# list regardless of this setting.
sync_channel_members: true
# Whether or not to automatically synchronize contacts and chats of Matrix users logged into
# their Telegram account at startup.
startup_sync: true
# The maximum number of simultaneous Telegram deletions to handle.
# A large number of simultaneous redactions could put strain on your homeserver.
max_telegram_delete: 10
+1
View File
@@ -202,6 +202,7 @@ class Config(DictWithRecursion):
copy("bridge.bot_messages_as_notices")
copy("bridge.max_initial_member_sync")
copy("bridge.sync_channel_members")
copy("bridge.startup_sync")
copy("bridge.sync_matrix_state")
copy("bridge.max_telegram_delete")
copy("bridge.allow_matrix_login")
+2 -2
View File
@@ -171,7 +171,7 @@ class User(AbstractUser):
async def post_login(self, info: TLUser = None) -> None:
try:
await self.update_info(info)
if not self.is_bot:
if not self.is_bot and config["bridge.startup_sync"]:
await self.sync_dialogs()
await self.sync_contacts()
if config["bridge.catch_up"]:
@@ -363,7 +363,7 @@ class User(AbstractUser):
return None
@classmethod
def get_by_tgid(cls, tgid: int) -> Optional['User']:
def get_by_tgid(cls, tgid: TelegramID) -> Optional['User']:
try:
return cls.by_tgid[tgid]
except KeyError: