mirror of
https://github.com/mautrix/telegram.git
synced 2026-05-17 07:25:46 +03:00
Fix potential issues with ignore_unbridged_group_chat option
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
# v0.15.1 (unreleased)
|
||||
|
||||
* Updated Docker image to Alpine 3.19.
|
||||
* Fixed some potential cases where a portal room would be created for the
|
||||
relaybot even if `ignore_unbridged_group_chat` was enabled.
|
||||
|
||||
# v0.15.0 (2023-11-26)
|
||||
|
||||
* Removed support for MSC2716 backfilling.
|
||||
|
||||
@@ -658,7 +658,11 @@ class AbstractUser(ABC):
|
||||
await portal.delete_telegram_user(self.tgid, sender=None)
|
||||
elif chan := getattr(update, "mau_channel", None):
|
||||
if not portal.mxid:
|
||||
background_task.create(self._delayed_create_channel(chan))
|
||||
if (
|
||||
not self.is_relaybot
|
||||
or not self.config["bridge.relaybot.ignore_unbridged_group_chat"]
|
||||
):
|
||||
background_task.create(self._delayed_create_channel(chan))
|
||||
else:
|
||||
self.log.debug("Updating channel info with data fetched by Telethon")
|
||||
await portal.update_info(self, chan)
|
||||
|
||||
@@ -787,6 +787,8 @@ class Portal(DBPortal, BasePortal):
|
||||
background_task.create(update)
|
||||
await self.invite_to_matrix(invites or [])
|
||||
return self.mxid
|
||||
elif user.is_relaybot and self.config["bridge.relaybot.ignore_unbridged_group_chat"]:
|
||||
raise Exception("create_matrix_room called as relaybot")
|
||||
async with self._room_create_lock:
|
||||
try:
|
||||
return await self._create_matrix_room(
|
||||
@@ -3372,6 +3374,8 @@ class Portal(DBPortal, BasePortal):
|
||||
self, source: au.AbstractUser, sender: p.Puppet | None, evt: Message
|
||||
) -> None:
|
||||
if not self.mxid:
|
||||
if source.is_relaybot and self.config["bridge.relaybot.ignore_unbridged_group_chat"]:
|
||||
return
|
||||
self.log.debug("Got telegram message %d, but no room exists, creating...", evt.id)
|
||||
await self.create_matrix_room(source, invites=[source.mxid], update_if_exists=False)
|
||||
if not self.mxid:
|
||||
@@ -3536,7 +3540,7 @@ class Portal(DBPortal, BasePortal):
|
||||
async def _create_room_on_action(
|
||||
self, source: au.AbstractUser, action: TypeMessageAction
|
||||
) -> bool:
|
||||
if source.is_relaybot and self.config["bridge.ignore_unbridged_group_chat"]:
|
||||
if source.is_relaybot and self.config["bridge.relaybot.ignore_unbridged_group_chat"]:
|
||||
return False
|
||||
create_and_exit = (MessageActionChatCreate, MessageActionChannelCreate)
|
||||
create_and_continue = (
|
||||
|
||||
Reference in New Issue
Block a user