mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-06-19 02:49:20 -04:00
Make reason and score optional for report_event (#10077)
Implements MSC2414: https://github.com/matrix-org/matrix-doc/pull/2414 See #8551 Signed-off-by: Callum Brown <callum@calcuode.com>
This commit is contained in:
parent
f828a70be3
commit
8fb9af570f
6 changed files with 105 additions and 13 deletions
|
@ -64,7 +64,7 @@ class EventReportsTestCase(unittest.HomeserverTestCase):
|
|||
user_tok=self.admin_user_tok,
|
||||
)
|
||||
for _ in range(5):
|
||||
self._create_event_and_report(
|
||||
self._create_event_and_report_without_parameters(
|
||||
room_id=self.room_id2,
|
||||
user_tok=self.admin_user_tok,
|
||||
)
|
||||
|
@ -378,6 +378,19 @@ class EventReportsTestCase(unittest.HomeserverTestCase):
|
|||
)
|
||||
self.assertEqual(200, int(channel.result["code"]), msg=channel.result["body"])
|
||||
|
||||
def _create_event_and_report_without_parameters(self, room_id, user_tok):
|
||||
"""Create and report an event, but omit reason and score"""
|
||||
resp = self.helper.send(room_id, tok=user_tok)
|
||||
event_id = resp["event_id"]
|
||||
|
||||
channel = self.make_request(
|
||||
"POST",
|
||||
"rooms/%s/report/%s" % (room_id, event_id),
|
||||
json.dumps({}),
|
||||
access_token=user_tok,
|
||||
)
|
||||
self.assertEqual(200, int(channel.result["code"]), msg=channel.result["body"])
|
||||
|
||||
def _check_fields(self, content):
|
||||
"""Checks that all attributes are present in an event report"""
|
||||
for c in content:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue