fix: ensure lazy platform chat ids before load selection

This commit is contained in:
Mikhail Putilovskij 2026-04-19 17:29:36 +03:00
parent 9cb1657d21
commit 0cdee532c4
2 changed files with 43 additions and 5 deletions

View file

@ -153,13 +153,16 @@ class MatrixBot:
return
sender = getattr(event, "sender", None)
body = (getattr(event, "body", None) or "").strip()
room_meta = await get_room_meta(self.runtime.store, room.room_id)
if room_meta is not None and not room_meta.get("redirect_room_id"):
await self._ensure_platform_chat_id(room.room_id, room_meta)
load_pending = await get_load_pending(self.runtime.store, sender, room.room_id)
if load_pending is not None and (body.isdigit() or body == "!cancel"):
outgoing = await self._handle_load_selection(sender, room.room_id, body, load_pending)
await self._send_all(room.room_id, outgoing)
return
room_meta = await get_room_meta(self.runtime.store, room.room_id)
if room_meta is None:
outgoing = await self._bootstrap_unregistered_room(room, sender)
if outgoing:
@ -187,9 +190,6 @@ class MatrixBot:
user=sender,
)
return
else:
await self._ensure_platform_chat_id(room.room_id, room_meta)
chat_id = await resolve_chat_id(self.runtime.store, room.room_id, sender)
incoming = from_room_event(event, room_id=room.room_id, chat_id=chat_id)
if incoming is None: