-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Implement MSC2414: Make reason and score parameters optional for reporting content #8551
Description
MSC2414 made the reason
and score
parameters for the POST /_matrix/client/r0/rooms/{roomId}/report/{eventId} endpoint.
That endpoint is implemented in Synapse here:
synapse/synapse/rest/client/v2_alpha/report_event.py
Lines 31 to 46 in 8a4a418
class ReportEventRestServlet(RestServlet): | |
PATTERNS = client_patterns("/rooms/(?P<room_id>[^/]*)/report/(?P<event_id>[^/]*)$") | |
def __init__(self, hs): | |
super().__init__() | |
self.hs = hs | |
self.auth = hs.get_auth() | |
self.clock = hs.get_clock() | |
self.store = hs.get_datastore() | |
async def on_POST(self, request, room_id, event_id): | |
requester = await self.auth.get_user_by_req(request) | |
user_id = requester.user.to_string() | |
body = parse_json_object_from_request(request) | |
assert_params_in_dict(body, ("reason", "score")) |
The Event Reports Admin API should also be updated to state that the reason
and content
fields may be both blank and null
, and the Admin API endpoint should be updated to expect None
values for these keys as well:
synapse/synapse/storage/databases/main/room.py
Lines 1388 to 1389 in cbabb31
er.reason, | |
er.content, |
(that function may not actually need updating, but it would be good to check that the API still behaves as expected).
Some tests for clients sending reports without reason
and score
would be great as well.
This will need to be implemented in order to eventually advertise support for the next Client-Server API version.