Add missing receiver_id when syncing direct chat dialogs (ref #425)
This commit is contained in:
@@ -402,6 +402,8 @@ class BasePortal(ABC):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def get_by_tgid(cls, tgid: TelegramID, tg_receiver: Optional[TelegramID] = None,
|
def get_by_tgid(cls, tgid: TelegramID, tg_receiver: Optional[TelegramID] = None,
|
||||||
peer_type: str = None) -> Optional['Portal']:
|
peer_type: str = None) -> Optional['Portal']:
|
||||||
|
if peer_type == "user" and tg_receiver is None:
|
||||||
|
raise ValueError("tg_receiver is required when peer_type is \"user\"")
|
||||||
tg_receiver = tg_receiver or tgid
|
tg_receiver = tg_receiver or tgid
|
||||||
tgid_full = (tgid, tg_receiver)
|
tgid_full = (tgid, tg_receiver)
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -348,7 +348,7 @@ class User(AbstractUser, BaseUser):
|
|||||||
continue
|
continue
|
||||||
elif isinstance(entity, TLUser) and not config["bridge.sync_direct_chats"]:
|
elif isinstance(entity, TLUser) and not config["bridge.sync_direct_chats"]:
|
||||||
continue
|
continue
|
||||||
portal = po.Portal.get_by_entity(entity)
|
portal = po.Portal.get_by_entity(entity, receiver_id=self.tgid)
|
||||||
self.portals[portal.tgid_full] = portal
|
self.portals[portal.tgid_full] = portal
|
||||||
creators.append(
|
creators.append(
|
||||||
portal.create_matrix_room(self, entity, invites=[self.mxid],
|
portal.create_matrix_room(self, entity, invites=[self.mxid],
|
||||||
|
|||||||
Reference in New Issue
Block a user