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

Use stable MSC3069 is_guest flag on /whoami #12021

Merged
merged 4 commits into from
Feb 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/12021.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Support only the stable identifier for [MSC3069](https://github.com/matrix-org/matrix-doc/pull/3069)'s `is_guest` on `/_matrix/client/v3/account/whoami`.
2 changes: 2 additions & 0 deletions synapse/rest/client/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,9 @@ async def on_GET(self, request: SynapseRequest) -> Tuple[int, JsonDict]:
response = {
"user_id": requester.user.to_string(),
# MSC: https://github.com/matrix-org/matrix-doc/pull/3069
# Entered spec in Matrix 1.2
"org.matrix.msc3069.is_guest": bool(requester.is_guest),
turt2live marked this conversation as resolved.
Show resolved Hide resolved
"is_guest": bool(requester.is_guest),
}

# Appservices and similar accounts do not have device IDs
Expand Down
9 changes: 6 additions & 3 deletions tests/rest/client/test_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,9 @@ def test_GET_whoami(self):
{
"user_id": user_id,
"device_id": device_id,
# Unstable until MSC3069 enters spec
# MSC3069 entered spec in Matrix 1.2 but maintained compatibility
"org.matrix.msc3069.is_guest": False,
"is_guest": False,
},
)

Expand All @@ -505,8 +506,9 @@ def test_GET_whoami_guests(self):
{
"user_id": user_id,
"device_id": device_id,
# Unstable until MSC3069 enters spec
# MSC3069 entered spec in Matrix 1.2 but maintained compatibility
"org.matrix.msc3069.is_guest": True,
"is_guest": True,
},
)

Expand All @@ -528,8 +530,9 @@ def test_GET_whoami_appservices(self):
whoami,
{
"user_id": user_id,
# Unstable until MSC3069 enters spec
# MSC3069 entered spec in Matrix 1.2 but maintained compatibility
"org.matrix.msc3069.is_guest": False,
"is_guest": False,
},
)
self.assertFalse(hasattr(whoami, "device_id"))
Expand Down