fix(01-05): align matrix confirmation scope with user and room
- carry Matrix room_id through command callbacks - persist pending confirmations by user_id and room_id
This commit is contained in:
parent
97a3dc35ea
commit
35695e043f
4 changed files with 62 additions and 25 deletions
|
|
@ -20,7 +20,7 @@ from adapter.matrix.converter import from_room_event
|
|||
from adapter.matrix.handlers import register_matrix_handlers
|
||||
from adapter.matrix.handlers.auth import handle_invite
|
||||
from adapter.matrix.room_router import resolve_chat_id
|
||||
from adapter.matrix.store import set_pending_confirm
|
||||
from adapter.matrix.store import get_room_meta, set_pending_confirm
|
||||
from core.auth import AuthManager
|
||||
from core.chat import ChatManager
|
||||
from core.handler import EventDispatcher
|
||||
|
|
@ -150,15 +150,19 @@ async def send_outgoing(
|
|||
if event.buttons and store is not None:
|
||||
action_id = event.buttons[0].action
|
||||
payload = event.buttons[0].payload
|
||||
await set_pending_confirm(
|
||||
store,
|
||||
room_id,
|
||||
{
|
||||
"action_id": action_id,
|
||||
"description": event.text,
|
||||
"payload": payload,
|
||||
},
|
||||
)
|
||||
room_meta = await get_room_meta(store, room_id)
|
||||
matrix_user_id = room_meta.get("matrix_user_id") if room_meta else None
|
||||
if matrix_user_id:
|
||||
await set_pending_confirm(
|
||||
store,
|
||||
matrix_user_id,
|
||||
room_id,
|
||||
{
|
||||
"action_id": action_id,
|
||||
"description": event.text,
|
||||
"payload": payload,
|
||||
},
|
||||
)
|
||||
return
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue