Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 0da5273

Browse files
Stabilise all knock-related unstable identifiers that would be in state (#96)
1 parent 232b324 commit 0da5273

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

synapse/api/constants.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Membership:
3434

3535
INVITE = "invite"
3636
JOIN = "join"
37-
KNOCK = "xyz.amorgan.knock"
37+
KNOCK = "knock"
3838
LEAVE = "leave"
3939
BAN = "ban"
4040
LIST = (INVITE, JOIN, KNOCK, LEAVE, BAN)
@@ -50,7 +50,7 @@ class PresenceState:
5050

5151
class JoinRules:
5252
PUBLIC = "public"
53-
KNOCK = "xyz.amorgan.knock"
53+
KNOCK = "knock"
5454
INVITE = "invite"
5555
PRIVATE = "private"
5656

tests/rest/client/v2_alpha/test_sync.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@
1616
import json
1717

1818
import synapse.rest.admin
19-
from synapse.api.constants import EventContentFields, EventTypes, RelationTypes
19+
from synapse.api.constants import (
20+
EventContentFields,
21+
EventTypes,
22+
Membership,
23+
RelationTypes,
24+
)
2025
from synapse.api.room_versions import RoomVersions
2126
from synapse.rest.client.v1 import login, room
2227
from synapse.rest.client.v2_alpha import knock, read_marker, sync
@@ -379,7 +384,7 @@ def test_knock_room_state(self):
379384

380385
# We expect to see the knock event in the stripped room state later
381386
self.expected_room_state[EventTypes.Member] = {
382-
"content": {"membership": "xyz.amorgan.knock", "displayname": "knocker"},
387+
"content": {"membership": Membership.KNOCK, "displayname": "knocker"},
383388
"state_key": "@knocker:test",
384389
}
385390

@@ -390,7 +395,7 @@ def test_knock_room_state(self):
390395
self.assertEqual(channel.code, 200, channel.json_body)
391396

392397
# Extract the stripped room state events from /sync
393-
knock_entry = channel.json_body["rooms"]["xyz.amorgan.knock"]
398+
knock_entry = channel.json_body["rooms"][Membership.KNOCK]
394399
room_state_events = knock_entry[self.room_id]["knock_state"]["events"]
395400

396401
# Validate that the knock membership event came last

0 commit comments

Comments
 (0)