Add config option to mark joined Telegram notices as read automatically

This commit is contained in:
Tulir Asokan
2022-03-30 11:58:40 +03:00
parent 474bcc9544
commit 58f8ee2ee2
3 changed files with 4 additions and 4 deletions
+1
View File
@@ -159,6 +159,7 @@ class Config(BaseBridgeConfig):
copy("bridge.tag_only_on_create")
copy("bridge.bridge_matrix_leave")
copy("bridge.kick_on_logout")
copy("bridge.always_read_joined_telegram_notice")
copy("bridge.backfill.invite_own_puppet")
copy("bridge.backfill.takeout_limit")
copy("bridge.backfill.initial_limit")
+2
View File
@@ -282,6 +282,8 @@ bridge:
bridge_matrix_leave: true
# Should the user be kicked out of all portals when logging out of the bridge?
kick_on_logout: true
# Should the "* user joined Telegram" notice always be marked as read automatically?
always_read_joined_telegram_notice: true
# Settings for backfilling messages from Telegram.
backfill:
# Whether or not the Telegram ghosts of logged in Matrix users should be
+1 -4
View File
@@ -3339,10 +3339,7 @@ class Portal(DBPortal, BasePortal):
tg_space=source.tgid,
edit_index=0,
).insert()
# Automatically mark the notice as read if we're backfilling messages, mostly so that
# empty rooms created before the notice was added wouldn't become unread when the notice
# is backfilled in.
if backfill:
if self.config["bridge.always_read_joined_telegram_notice"]:
double_puppet = await p.Puppet.get_by_tgid(source.tgid)
if double_puppet and double_puppet.is_real_user:
await double_puppet.intent.mark_read(self.mxid, event_id)