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

Commit 8bdf3dd

Browse files
authored
Add namespaced version of inbox state endpoint (#30)
1 parent e4913c9 commit 8bdf3dd

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

synapse/rest/client/account_data.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,16 @@ class RoomBeeperInboxStateServlet(RestServlet):
160160
PUT /user/{user_id}/rooms/{room_id}/beeper_inbox_state HTTP/1.1
161161
"""
162162

163-
PATTERNS = client_patterns(
164-
"/user/(?P<user_id>[^/]*)/rooms/(?P<room_id>[^/]*)/beeper_inbox_state"
163+
PATTERNS = list(
164+
client_patterns(
165+
"/com.beeper.inbox/user/(?P<user_id>[^/]*)/rooms/(?P<room_id>[^/]*)/inbox_state",
166+
releases=(), # not in the matrix spec, only include under /unstable
167+
)
168+
) + list(
169+
# Improperly namespaced version of the above endpoint (TODO: remove once everything uses the namespaced version)
170+
client_patterns(
171+
"/user/(?P<user_id>[^/]*)/rooms/(?P<room_id>[^/]*)/beeper_inbox_state"
172+
)
165173
)
166174

167175
def __init__(self, hs: "HomeServer"):

tests/rest/client/test_account_data.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def test_beeper_inbox_state_endpoint(self) -> None:
8383
room_id = self.helper.create_room_as(user_id, tok=tok)
8484
channel = self.make_request(
8585
"PUT",
86-
f"/user/{user_id}/rooms/{room_id}/beeper_inbox_state",
86+
f"/_matrix/client/unstable/com.beeper.inbox/user/{user_id}/rooms/{room_id}/inbox_state",
8787
{},
8888
access_token=tok,
8989
)
@@ -106,7 +106,7 @@ def test_beeper_inbox_state_endpoint(self) -> None:
106106

107107
channel = self.make_request(
108108
"PUT",
109-
f"/user/{user_id}/rooms/{room_id}/beeper_inbox_state",
109+
f"/_matrix/client/unstable/com.beeper.inbox/user/{user_id}/rooms/{room_id}/inbox_state",
110110
{"done": {"at_delta": 1000 * 60 * 5}, "marked_unread": True},
111111
access_token=tok,
112112
)
@@ -142,7 +142,7 @@ def test_beeper_inbox_state_endpoint_can_clear_unread(self) -> None:
142142
room_id = self.helper.create_room_as(user_id, tok=tok)
143143
channel = self.make_request(
144144
"PUT",
145-
f"/user/{user_id}/rooms/{room_id}/beeper_inbox_state",
145+
f"/_matrix/client/unstable/com.beeper.inbox/user/{user_id}/rooms/{room_id}/inbox_state",
146146
{"marked_unread": False},
147147
access_token=tok,
148148
)

0 commit comments

Comments
 (0)