Add option to disable backfilling normal groups

This commit is contained in:
Tulir Asokan
2020-08-01 14:11:34 +03:00
parent 729fa8eb46
commit bc4610af04
4 changed files with 10 additions and 0 deletions
@@ -346,6 +346,9 @@ async def backfill(evt: CommandEvent) -> None:
except (ValueError, IndexError):
limit = -1
portal = po.Portal.get_by_mxid(evt.room_id)
if not evt.config["bridge.backfill.normal_groups"] and portal.peer_type == "chat":
await evt.reply("Backfilling normal groups is disabled in the bridge config")
return
try:
await portal.backfill(evt.sender, limit=limit)
except TakeoutInitDelayError:
+1
View File
@@ -123,6 +123,7 @@ class Config(BaseBridgeConfig):
copy("bridge.backfill.initial_limit")
copy("bridge.backfill.missed_limit")
copy("bridge.backfill.disable_notifications")
copy("bridge.backfill.normal_groups")
copy("bridge.initial_power_level_overrides.group")
copy("bridge.initial_power_level_overrides.user")
+4
View File
@@ -260,6 +260,10 @@ bridge:
# If using double puppeting, should notifications be disabled
# while the initial backfill is in progress?
disable_notifications: false
# Whether or not to enable backfilling in normal groups.
# Normal groups have numerous technical problems in Telegram, and backfilling normal groups
# will likely cause problems if there are multiple Matrix users in the group.
normal_groups: false
# Overrides for base power levels.
initial_power_level_overrides:
+2
View File
@@ -427,6 +427,8 @@ class PortalTelegram(BasePortal, ABC):
else config["bridge.backfill.missed_limit"])
if limit == 0:
return
if not config["bridge.backfill.normal_groups"] and self.peer_type == "chat":
return
last = DBMessage.find_last(self.mxid, (source.tgid if self.peer_type != "channel"
else self.tgid))
min_id = last.tgid if last else 0