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

Commit

Permalink
Stabilise all knock-related unstable identifiers that would be in sta…
Browse files Browse the repository at this point in the history
…te (#96)
  • Loading branch information
anoadragon453 authored Mar 23, 2021
1 parent 232b324 commit 0da5273
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions synapse/api/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Membership:

INVITE = "invite"
JOIN = "join"
KNOCK = "xyz.amorgan.knock"
KNOCK = "knock"
LEAVE = "leave"
BAN = "ban"
LIST = (INVITE, JOIN, KNOCK, LEAVE, BAN)
Expand All @@ -50,7 +50,7 @@ class PresenceState:

class JoinRules:
PUBLIC = "public"
KNOCK = "xyz.amorgan.knock"
KNOCK = "knock"
INVITE = "invite"
PRIVATE = "private"

Expand Down
11 changes: 8 additions & 3 deletions tests/rest/client/v2_alpha/test_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@
import json

import synapse.rest.admin
from synapse.api.constants import EventContentFields, EventTypes, RelationTypes
from synapse.api.constants import (
EventContentFields,
EventTypes,
Membership,
RelationTypes,
)
from synapse.api.room_versions import RoomVersions
from synapse.rest.client.v1 import login, room
from synapse.rest.client.v2_alpha import knock, read_marker, sync
Expand Down Expand Up @@ -379,7 +384,7 @@ def test_knock_room_state(self):

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

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

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

# Validate that the knock membership event came last
Expand Down

0 comments on commit 0da5273

Please sign in to comment.