diff options
author | Travis Ralston <travisr@matrix.org> | 2022-02-18 05:48:23 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-18 07:48:23 -0500 |
commit | 19bd9cff1afba2149ae58cd5b5648470c48d51a5 (patch) | |
tree | 318bffa8d5fc11d274e8fa4f47727ab9c60dd159 | |
parent | Fix 500 error with Postgres when looking backwards with the MSC3030 `/timesta... (diff) | |
download | synapse-19bd9cff1afba2149ae58cd5b5648470c48d51a5.tar.xz |
Use stable MSC3069 `is_guest` flag on `/whoami`. (#12021)
Keeping backwards compatibility with the unstable flag for now.
-rw-r--r-- | changelog.d/12021.feature | 1 | ||||
-rw-r--r-- | synapse/rest/client/account.py | 2 | ||||
-rw-r--r-- | tests/rest/client/test_account.py | 9 |
3 files changed, 9 insertions, 3 deletions
diff --git a/changelog.d/12021.feature b/changelog.d/12021.feature new file mode 100644 index 0000000000..01378df8ca --- /dev/null +++ b/changelog.d/12021.feature @@ -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`. \ No newline at end of file diff --git a/synapse/rest/client/account.py b/synapse/rest/client/account.py index cfa2aee76d..efe299e698 100644 --- a/synapse/rest/client/account.py +++ b/synapse/rest/client/account.py @@ -883,7 +883,9 @@ class WhoamiRestServlet(RestServlet): 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), + "is_guest": bool(requester.is_guest), } # Appservices and similar accounts do not have device IDs diff --git a/tests/rest/client/test_account.py b/tests/rest/client/test_account.py index 89d85b0a17..51146c471d 100644 --- a/tests/rest/client/test_account.py +++ b/tests/rest/client/test_account.py @@ -486,8 +486,9 @@ class WhoamiTestCase(unittest.HomeserverTestCase): { "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, }, ) @@ -505,8 +506,9 @@ class WhoamiTestCase(unittest.HomeserverTestCase): { "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, }, ) @@ -528,8 +530,9 @@ class WhoamiTestCase(unittest.HomeserverTestCase): 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")) |