|
|
|
@ -201,8 +201,8 @@ class RoomStateEventRestServlet(TransactionRestServlet): |
|
|
|
|
if state_key is not None: |
|
|
|
|
event_dict["state_key"] = state_key |
|
|
|
|
|
|
|
|
|
if event_type == EventTypes.Member: |
|
|
|
|
try: |
|
|
|
|
try: |
|
|
|
|
if event_type == EventTypes.Member: |
|
|
|
|
membership = content.get("membership", None) |
|
|
|
|
event_id, _ = await self.room_member_handler.update_membership( |
|
|
|
|
requester, |
|
|
|
@ -211,16 +211,16 @@ class RoomStateEventRestServlet(TransactionRestServlet): |
|
|
|
|
action=membership, |
|
|
|
|
content=content, |
|
|
|
|
) |
|
|
|
|
except ShadowBanError: |
|
|
|
|
event_id = "$" + random_string(43) |
|
|
|
|
else: |
|
|
|
|
( |
|
|
|
|
event, |
|
|
|
|
_, |
|
|
|
|
) = await self.event_creation_handler.create_and_send_nonmember_event( |
|
|
|
|
requester, event_dict, txn_id=txn_id |
|
|
|
|
) |
|
|
|
|
event_id = event.event_id |
|
|
|
|
else: |
|
|
|
|
( |
|
|
|
|
event, |
|
|
|
|
_, |
|
|
|
|
) = await self.event_creation_handler.create_and_send_nonmember_event( |
|
|
|
|
requester, event_dict, txn_id=txn_id |
|
|
|
|
) |
|
|
|
|
event_id = event.event_id |
|
|
|
|
except ShadowBanError: |
|
|
|
|
event_id = "$" + random_string(43) |
|
|
|
|
|
|
|
|
|
set_tag("event_id", event_id) |
|
|
|
|
ret = {"event_id": event_id} |
|
|
|
@ -253,12 +253,19 @@ class RoomSendEventRestServlet(TransactionRestServlet): |
|
|
|
|
if b"ts" in request.args and requester.app_service: |
|
|
|
|
event_dict["origin_server_ts"] = parse_integer(request, "ts", 0) |
|
|
|
|
|
|
|
|
|
event, _ = await self.event_creation_handler.create_and_send_nonmember_event( |
|
|
|
|
requester, event_dict, txn_id=txn_id |
|
|
|
|
) |
|
|
|
|
try: |
|
|
|
|
( |
|
|
|
|
event, |
|
|
|
|
_, |
|
|
|
|
) = await self.event_creation_handler.create_and_send_nonmember_event( |
|
|
|
|
requester, event_dict, txn_id=txn_id |
|
|
|
|
) |
|
|
|
|
event_id = event.event_id |
|
|
|
|
except ShadowBanError: |
|
|
|
|
event_id = "$" + random_string(43) |
|
|
|
|
|
|
|
|
|
set_tag("event_id", event.event_id) |
|
|
|
|
return 200, {"event_id": event.event_id} |
|
|
|
|
set_tag("event_id", event_id) |
|
|
|
|
return 200, {"event_id": event_id} |
|
|
|
|
|
|
|
|
|
def on_GET(self, request, room_id, event_type, txn_id): |
|
|
|
|
return 200, "Not implemented" |
|
|
|
@ -799,20 +806,27 @@ class RoomRedactEventRestServlet(TransactionRestServlet): |
|
|
|
|
requester = await self.auth.get_user_by_req(request) |
|
|
|
|
content = parse_json_object_from_request(request) |
|
|
|
|
|
|
|
|
|
event, _ = await self.event_creation_handler.create_and_send_nonmember_event( |
|
|
|
|
requester, |
|
|
|
|
{ |
|
|
|
|
"type": EventTypes.Redaction, |
|
|
|
|
"content": content, |
|
|
|
|
"room_id": room_id, |
|
|
|
|
"sender": requester.user.to_string(), |
|
|
|
|
"redacts": event_id, |
|
|
|
|
}, |
|
|
|
|
txn_id=txn_id, |
|
|
|
|
) |
|
|
|
|
try: |
|
|
|
|
( |
|
|
|
|
event, |
|
|
|
|
_, |
|
|
|
|
) = await self.event_creation_handler.create_and_send_nonmember_event( |
|
|
|
|
requester, |
|
|
|
|
{ |
|
|
|
|
"type": EventTypes.Redaction, |
|
|
|
|
"content": content, |
|
|
|
|
"room_id": room_id, |
|
|
|
|
"sender": requester.user.to_string(), |
|
|
|
|
"redacts": event_id, |
|
|
|
|
}, |
|
|
|
|
txn_id=txn_id, |
|
|
|
|
) |
|
|
|
|
event_id = event.event_id |
|
|
|
|
except ShadowBanError: |
|
|
|
|
event_id = "$" + random_string(43) |
|
|
|
|
|
|
|
|
|
set_tag("event_id", event.event_id) |
|
|
|
|
return 200, {"event_id": event.event_id} |
|
|
|
|
set_tag("event_id", event_id) |
|
|
|
|
return 200, {"event_id": event_id} |
|
|
|
|
|
|
|
|
|
def on_PUT(self, request, room_id, event_id, txn_id): |
|
|
|
|
set_tag("txn_id", txn_id) |
|
|
|
|