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

Commit

Permalink
Add namespaced version of inbox state endpoint (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir authored Oct 28, 2022
1 parent e4913c9 commit 8bdf3dd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
12 changes: 10 additions & 2 deletions synapse/rest/client/account_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,16 @@ class RoomBeeperInboxStateServlet(RestServlet):
PUT /user/{user_id}/rooms/{room_id}/beeper_inbox_state HTTP/1.1
"""

PATTERNS = client_patterns(
"/user/(?P<user_id>[^/]*)/rooms/(?P<room_id>[^/]*)/beeper_inbox_state"
PATTERNS = list(
client_patterns(
"/com.beeper.inbox/user/(?P<user_id>[^/]*)/rooms/(?P<room_id>[^/]*)/inbox_state",
releases=(), # not in the matrix spec, only include under /unstable
)
) + list(
# Improperly namespaced version of the above endpoint (TODO: remove once everything uses the namespaced version)
client_patterns(
"/user/(?P<user_id>[^/]*)/rooms/(?P<room_id>[^/]*)/beeper_inbox_state"
)
)

def __init__(self, hs: "HomeServer"):
Expand Down
6 changes: 3 additions & 3 deletions tests/rest/client/test_account_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def test_beeper_inbox_state_endpoint(self) -> None:
room_id = self.helper.create_room_as(user_id, tok=tok)
channel = self.make_request(
"PUT",
f"/user/{user_id}/rooms/{room_id}/beeper_inbox_state",
f"/_matrix/client/unstable/com.beeper.inbox/user/{user_id}/rooms/{room_id}/inbox_state",
{},
access_token=tok,
)
Expand All @@ -106,7 +106,7 @@ def test_beeper_inbox_state_endpoint(self) -> None:

channel = self.make_request(
"PUT",
f"/user/{user_id}/rooms/{room_id}/beeper_inbox_state",
f"/_matrix/client/unstable/com.beeper.inbox/user/{user_id}/rooms/{room_id}/inbox_state",
{"done": {"at_delta": 1000 * 60 * 5}, "marked_unread": True},
access_token=tok,
)
Expand Down Expand Up @@ -142,7 +142,7 @@ def test_beeper_inbox_state_endpoint_can_clear_unread(self) -> None:
room_id = self.helper.create_room_as(user_id, tok=tok)
channel = self.make_request(
"PUT",
f"/user/{user_id}/rooms/{room_id}/beeper_inbox_state",
f"/_matrix/client/unstable/com.beeper.inbox/user/{user_id}/rooms/{room_id}/inbox_state",
{"marked_unread": False},
access_token=tok,
)
Expand Down

0 comments on commit 8bdf3dd

Please sign in to comment.