-
Notifications
You must be signed in to change notification settings - Fork 564
MSC4311: invites and knocks should contain the create event #19722
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Partial [MSC4311](https://github.com/matrix-org/matrix-spec-proposals/pull/4311) implementation: `m.room.create` is now a required part of stripped `invite_state`/`knock_state` . Contributed by @FrenchGithubUser @Famedly. |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -29,6 +29,7 @@ | |||||
| from synapse.api.constants import ( | ||||||
| EventContentFields, | ||||||
| EventTypes, | ||||||
| JoinRules, | ||||||
| ReceiptTypes, | ||||||
| RelationTypes, | ||||||
| ) | ||||||
|
|
@@ -394,6 +395,69 @@ def test_knock_room_state(self) -> None: | |||||
| ) | ||||||
|
|
||||||
|
|
||||||
| class SyncCreateEventInPrejoinStateTestCase(unittest.HomeserverTestCase): | ||||||
| """MSC4311: Tests that m.room.create is present in invite_state and knock_state""" | ||||||
|
|
||||||
| servlets = [ | ||||||
| synapse.rest.admin.register_servlets, | ||||||
| login.register_servlets, | ||||||
| room.register_servlets, | ||||||
| sync.register_servlets, | ||||||
| knock.register_servlets, | ||||||
| ] | ||||||
|
|
||||||
| def default_config(self) -> JsonDict: | ||||||
| config = super().default_config() | ||||||
| return config | ||||||
|
|
||||||
| def test_create_event_present_in_invite_state(self) -> None: | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For reference, it looks like we also have It looks like that test already passes on
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like this is a combination of MSC1772 but it was only a recommendation. And MSC4311 changes that to a requirement Lines 94 to 95 in 93e0497
And then there was a flawed partial MSC4311 implementation introduced in 0eb7252. I'm reverting that change in #19723 |
||||||
| """m.room.create must appear in invite_state.""" | ||||||
| inviter = self.register_user("inviter", "pass") | ||||||
| inviter_tok = self.login("inviter", "pass") | ||||||
| invitee = self.register_user("invitee", "pass") | ||||||
| invitee_tok = self.login("invitee", "pass") | ||||||
|
|
||||||
| room_id = self.helper.create_room_as(inviter, tok=inviter_tok) | ||||||
| self.helper.invite(room=room_id, src=inviter, targ=invitee, tok=inviter_tok) | ||||||
|
|
||||||
| channel = self.make_request("GET", "/sync", access_token=invitee_tok) | ||||||
| self.assertEqual(channel.code, 200, channel.json_body) | ||||||
|
|
||||||
| invite_state_events = channel.json_body["rooms"]["invite"][room_id][ | ||||||
| "invite_state" | ||||||
| ]["events"] | ||||||
| event_types = {stripped_event["type"] for stripped_event in invite_state_events} | ||||||
| self.assertIn(EventTypes.Create, event_types) | ||||||
|
|
||||||
| def test_create_event_present_in_knock_state(self) -> None: | ||||||
| """m.room.create must appear in knock_state.""" | ||||||
| host = self.register_user("host", "pass") | ||||||
| host_tok = self.login("host", "pass") | ||||||
| knocker = self.register_user("knocker", "pass") | ||||||
| knocker_tok = self.login("knocker", "pass") | ||||||
|
|
||||||
| room_id = self.helper.create_room_as( | ||||||
| host, is_public=False, room_version="7", tok=host_tok | ||||||
| ) | ||||||
| self.helper.send_state( | ||||||
| room_id, | ||||||
| EventTypes.JoinRules, | ||||||
| {"join_rule": JoinRules.KNOCK}, | ||||||
| tok=host_tok, | ||||||
| ) | ||||||
|
|
||||||
| self.helper.knock(room_id, knocker, tok=knocker_tok) | ||||||
|
|
||||||
| channel = self.make_request("GET", "/sync", access_token=knocker_tok) | ||||||
| self.assertEqual(channel.code, 200, channel.json_body) | ||||||
|
|
||||||
| knock_state_events = channel.json_body["rooms"]["knock"][room_id][ | ||||||
| "knock_state" | ||||||
| ]["events"] | ||||||
| event_types = {stripped_event["type"] for stripped_event in knock_state_events} | ||||||
| self.assertIn(EventTypes.Create, event_types) | ||||||
|
|
||||||
|
|
||||||
| class UnreadMessagesTestCase(unittest.HomeserverTestCase): | ||||||
| servlets = [ | ||||||
| synapse.rest.admin.register_servlets, | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this PR also cover including the full
m.room.createevent PDU in theinvite_room_state/knock_room_stateonm.room.memberevents (inunsigned)This is coming from looking at #19414 and seeing the
Server-Server(federation) changes mentioned as well for MSC4311There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With further understanding as I review this, my guess is no (which is fine, something for another PR)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed, it doesn't cover including the full
m.room.createevent PDU