From e366aa14c47500cf6c798ad661f9168922789006 Mon Sep 17 00:00:00 2001 From: Shay Date: Fri, 14 Jul 2023 12:52:38 -0700 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Patrick Cloke --- changelog.d/15929.feature | 4 +--- synapse/handlers/devicemessage.py | 4 ++-- synapse/rest/client/devices.py | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/changelog.d/15929.feature b/changelog.d/15929.feature index f0814ec15dd9..c3aaeae66ee7 100644 --- a/changelog.d/15929.feature +++ b/changelog.d/15929.feature @@ -1,3 +1 @@ -Implement [MSC3814](https://github.com/matrix-org/matrix-spec-proposals/pull/3814), -dehydrated devices v2/shrivelled sessions and move [MSC2697](https://github.com/matrix-org/matrix-spec-proposals/pull/2697) -behind a config flag. Contributed by Nico from Famedly and H-Shay. +Implement [MSC3814](https://github.com/matrix-org/matrix-spec-proposals/pull/3814), dehydrated devices v2/shrivelled sessions and move [MSC2697](https://github.com/matrix-org/matrix-spec-proposals/pull/2697) behind a config flag. Contributed by Nico from Famedly and H-Shay. diff --git a/synapse/handlers/devicemessage.py b/synapse/handlers/devicemessage.py index 621f4c4449c1..3f7887806cf2 100644 --- a/synapse/handlers/devicemessage.py +++ b/synapse/handlers/devicemessage.py @@ -330,8 +330,8 @@ async def get_events_for_dehydrated_device( # only allow fetching messages for the dehydrated device id currently associated # with the user - dehydrated_device = await self.device_handler.get_dehydrated_device(user_id) - if dehydrated_device is None or device_id != dehydrated_device[0]: + dehydrated_device_id, _ = await self.device_handler.get_dehydrated_device(user_id) + if dehydrated_device_id is None or device_id != dehydrated_device_id: raise SynapseError( HTTPStatus.FORBIDDEN, "You may only fetch messages for your dehydrated device", diff --git a/synapse/rest/client/devices.py b/synapse/rest/client/devices.py index 3223764464a4..89776f639263 100644 --- a/synapse/rest/client/devices.py +++ b/synapse/rest/client/devices.py @@ -231,7 +231,7 @@ class Config: class DehydratedDeviceServlet(RestServlet): """Retrieve or store a dehydrated device. - Implements both MSC2697 and MSC3814. + Implements either MSC2697 and MSC3814. GET /org.matrix.msc2697.v2/dehydrated_device