Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Andrew Morgan <[email protected]>
  • Loading branch information
sandhose and anoadragon453 authored Dec 4, 2024
1 parent 34a7519 commit 71302b9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion synapse/config/appservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def _load_appservice(
)

# Opt-in flag for the MSC4190 behaviours.
# When enabled, the following C-S API endpoints change:
# When enabled, the following C-S API endpoints change for appservices:
# - POST /register does not return an access token
# - PUT /devices/{device_id} creates a new device if one does not exist
# - DELETE /devices/{device_id} no longer requires UIA
Expand Down
6 changes: 4 additions & 2 deletions tests/handlers/test_appservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -1168,8 +1168,10 @@ def prepare(self, reactor: MemoryReactor, clock: Clock, hs: HomeServer) -> None:
user_id, device_id = self.register_appservice_user(
"as.sender", self._service_token
)
# With MSC4190 enabled, we may not have a device out of the
# registration, but we don't have it enabled in this test
# With MSC4190 enabled, there will not be a device created
# during AS registration. However MSC4190 is not enabled
# in this test. It may become the default behaviour in the
# future, in which case this test will need to be updated.
assert device_id is not None
self._sender_user = user_id
self._sender_device = device_id
Expand Down
6 changes: 4 additions & 2 deletions tests/rest/client/test_devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,8 @@ def test_PUT_device(self) -> None:
)
self.assertEqual(channel.code, 200, channel.json_body)

# On the regular service, that API sh
# On the regular service, that API should not allow for the
# creation of new devices.
channel = self.make_request(
"PUT",
"/_matrix/client/v3/devices/AABBCCDD?user_id=@bob:test",
Expand Down Expand Up @@ -568,7 +569,7 @@ def test_DELETE_device(self) -> None:
self.assertEqual(channel.code, 200, channel.json_body)
self.assertEqual(len(channel.json_body["devices"]), 1)

# Delete the device
# Delete the device. UIA should not be required.
channel = self.make_request(
"DELETE",
"/_matrix/client/v3/devices/AABBCCDD?user_id=@alice:test",
Expand Down Expand Up @@ -616,6 +617,7 @@ def test_POST_delete_devices(self) -> None:
self.assertEqual(len(channel.json_body["devices"]), 1)

# Delete the device with delete_devices
# UIA should not be required.
channel = self.make_request(
"POST",
"/_matrix/client/v3/delete_devices?user_id=@alice:test",
Expand Down

0 comments on commit 71302b9

Please sign in to comment.