From ef05875bfd1e5d968a3cef9a78eb2904e1d6d921 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Wed, 22 Jun 2022 12:39:17 +0300 Subject: [PATCH] Remove plaintext_highlights config option The code using it was removed in v0.11.0, so it hasn't actually worked for a while now. --- mautrix_telegram/config.py | 1 - mautrix_telegram/db/puppet.py | 5 ----- mautrix_telegram/example-config.yaml | 4 ---- mautrix_telegram/puppet.py | 19 ------------------- 4 files changed, 29 deletions(-) diff --git a/mautrix_telegram/config.py b/mautrix_telegram/config.py index f22929b6..1a3656e1 100644 --- a/mautrix_telegram/config.py +++ b/mautrix_telegram/config.py @@ -125,7 +125,6 @@ class Config(BaseBridgeConfig): copy("bridge.max_telegram_delete") copy("bridge.sync_matrix_state") copy("bridge.allow_matrix_login") - copy("bridge.plaintext_highlights") copy("bridge.public_portals") copy("bridge.sync_with_custom_puppets") copy("bridge.sync_direct_chat_list") diff --git a/mautrix_telegram/db/puppet.py b/mautrix_telegram/db/puppet.py index 37b7a0f7..d97c8f1a 100644 --- a/mautrix_telegram/db/puppet.py +++ b/mautrix_telegram/db/puppet.py @@ -90,11 +90,6 @@ class Puppet: q = f"SELECT {cls.columns} FROM puppet WHERE lower(username)=$1" return cls._from_row(await cls.db.fetchrow(q, username.lower())) - @classmethod - async def find_by_displayname(cls, displayname: str) -> Puppet | None: - q = f"SELECT {cls.columns} FROM puppet WHERE displayname=$1" - return cls._from_row(await cls.db.fetchrow(q, displayname)) - @property def _values(self): return ( diff --git a/mautrix_telegram/example-config.yaml b/mautrix_telegram/example-config.yaml index d041cfc6..0b02f97e 100644 --- a/mautrix_telegram/example-config.yaml +++ b/mautrix_telegram/example-config.yaml @@ -178,10 +178,6 @@ bridge: # Allow logging in within Matrix. If false, users can only log in using login-qr or the # out-of-Matrix login website (see appservice.public config section) allow_matrix_login: true - # Whether or not to bridge plaintext highlights. - # Only enable this if your displayname_template has some static part that the bridge can use to - # reliably identify what is a plaintext highlight. - plaintext_highlights: false # Whether or not to make portals of publicly joinable channels/supergroups publicly joinable on Matrix. public_portals: true # Whether or not to use /sync to get presence, read receipts and typing notifications diff --git a/mautrix_telegram/puppet.py b/mautrix_telegram/puppet.py index e94b9bab..f7fb63e1 100644 --- a/mautrix_telegram/puppet.py +++ b/mautrix_telegram/puppet.py @@ -512,23 +512,4 @@ class Puppet(DBPuppet, BasePuppet): return None - @classmethod - async def find_by_displayname(cls, displayname: str) -> Puppet | None: - if not displayname: - return None - - for _, puppet in cls.by_tgid.items(): - if puppet.displayname and puppet.displayname == displayname: - return puppet - - puppet = cast(cls, await super().find_by_displayname(displayname)) - if puppet: - try: - return cls.by_tgid[puppet.tgid] - except KeyError: - puppet._add_to_cache() - return puppet - - return None - # endregion