Assign matrix platform chat ids on creation
This commit is contained in:
parent
0cdee532c4
commit
8270e5821e
4 changed files with 76 additions and 35 deletions
|
|
@ -7,7 +7,7 @@ from nio.api import RoomVisibility
|
|||
from nio.responses import RoomCreateError
|
||||
|
||||
from adapter.matrix.handlers.chat import make_handle_archive, make_handle_new_chat, make_handle_rename
|
||||
from adapter.matrix.store import set_user_meta
|
||||
from adapter.matrix.store import get_room_meta, set_user_meta
|
||||
from core.auth import AuthManager
|
||||
from core.chat import ChatManager
|
||||
from core.protocol import IncomingCommand, OutgoingMessage
|
||||
|
|
@ -57,6 +57,9 @@ async def test_mat04_new_chat_calls_room_put_state_with_space_id():
|
|||
assert kwargs.get("room_id") == "!space:ex"
|
||||
assert kwargs.get("event_type") == "m.space.child"
|
||||
assert kwargs.get("state_key") == "!newroom:ex"
|
||||
room_meta = await get_room_meta(store, "!newroom:ex")
|
||||
assert room_meta is not None
|
||||
assert room_meta["platform_chat_id"] == "matrix:!newroom:ex"
|
||||
assert any(isinstance(item, OutgoingMessage) and "Test" in item.text for item in result)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ async def test_mat01_invite_creates_space_and_chat1():
|
|||
assert room_meta is not None
|
||||
assert room_meta["chat_id"] == "C4"
|
||||
assert room_meta["space_id"] == "!space:example.org"
|
||||
assert room_meta["platform_chat_id"] == "matrix:!chat1:example.org"
|
||||
assert user_meta["next_chat_index"] == 5
|
||||
|
||||
chats = await runtime.chat_mgr.list_active("@alice:example.org")
|
||||
|
|
@ -119,6 +120,7 @@ async def test_mat03_no_hardcoded_c1():
|
|||
room_meta = await get_room_meta(runtime.store, "!chat1:example.org")
|
||||
assert room_meta is not None
|
||||
assert room_meta["chat_id"] == "C7"
|
||||
assert room_meta["platform_chat_id"] == "matrix:!chat1:example.org"
|
||||
|
||||
user_meta = await get_user_meta(runtime.store, "@alice:example.org")
|
||||
assert user_meta is not None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue