Add option to disable startup sync. Fixes #176
This commit is contained in:
@@ -104,6 +104,9 @@ bridge:
|
|||||||
# If no channel admins have logged into the bridge, the bridge won't be able to sync the member
|
# If no channel admins have logged into the bridge, the bridge won't be able to sync the member
|
||||||
# list regardless of this setting.
|
# list regardless of this setting.
|
||||||
sync_channel_members: true
|
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.
|
# The maximum number of simultaneous Telegram deletions to handle.
|
||||||
# A large number of simultaneous redactions could put strain on your homeserver.
|
# A large number of simultaneous redactions could put strain on your homeserver.
|
||||||
max_telegram_delete: 10
|
max_telegram_delete: 10
|
||||||
|
|||||||
@@ -202,6 +202,7 @@ class Config(DictWithRecursion):
|
|||||||
copy("bridge.bot_messages_as_notices")
|
copy("bridge.bot_messages_as_notices")
|
||||||
copy("bridge.max_initial_member_sync")
|
copy("bridge.max_initial_member_sync")
|
||||||
copy("bridge.sync_channel_members")
|
copy("bridge.sync_channel_members")
|
||||||
|
copy("bridge.startup_sync")
|
||||||
copy("bridge.sync_matrix_state")
|
copy("bridge.sync_matrix_state")
|
||||||
copy("bridge.max_telegram_delete")
|
copy("bridge.max_telegram_delete")
|
||||||
copy("bridge.allow_matrix_login")
|
copy("bridge.allow_matrix_login")
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ class User(AbstractUser):
|
|||||||
async def post_login(self, info: TLUser = None) -> None:
|
async def post_login(self, info: TLUser = None) -> None:
|
||||||
try:
|
try:
|
||||||
await self.update_info(info)
|
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_dialogs()
|
||||||
await self.sync_contacts()
|
await self.sync_contacts()
|
||||||
if config["bridge.catch_up"]:
|
if config["bridge.catch_up"]:
|
||||||
@@ -363,7 +363,7 @@ class User(AbstractUser):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_by_tgid(cls, tgid: int) -> Optional['User']:
|
def get_by_tgid(cls, tgid: TelegramID) -> Optional['User']:
|
||||||
try:
|
try:
|
||||||
return cls.by_tgid[tgid]
|
return cls.by_tgid[tgid]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
|||||||
Reference in New Issue
Block a user