For DM checks, use ID of sender instead of channel
This is more migration away from FB's usage of user IDs as DM IDs
This commit is contained in:
parent
421bba7f1f
commit
91af7890ac
@ -34,7 +34,6 @@ from .db import Puppet as DBPuppet
|
||||
from .kt.types.bson import Long
|
||||
|
||||
from .kt.types.api.struct import FriendStruct
|
||||
from .kt.types.channel.channel_type import KnownChannelType
|
||||
from .kt.client.types import UserInfoUnion
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@ -96,9 +95,8 @@ class Puppet(DBPuppet, BasePuppet):
|
||||
return False
|
||||
|
||||
async def default_puppet_should_leave_room(self, room_id: RoomID) -> bool:
|
||||
# TODO Find out if direct channels are shared. If not, default puppet shouldn't leave!
|
||||
portal = await p.Portal.get_by_mxid(room_id)
|
||||
return portal and portal.kt_type != KnownChannelType.MemoChat
|
||||
return portal and portal.kt_sender != self.ktid
|
||||
|
||||
async def _leave_rooms_with_default_user(self) -> None:
|
||||
await super()._leave_rooms_with_default_user()
|
||||
@ -112,7 +110,7 @@ class Puppet(DBPuppet, BasePuppet):
|
||||
)
|
||||
|
||||
def intent_for(self, portal: p.Portal) -> IntentAPI:
|
||||
if portal.ktid == self.ktid or (
|
||||
if portal.kt_sender == self.ktid or (
|
||||
portal.backfill_lock.locked and self.config["bridge.backfill.invite_own_puppet"]
|
||||
):
|
||||
return self.default_mxid_intent
|
||||
|
Loading…
Reference in New Issue
Block a user