Merge remote-tracking branch 'upstream/release-v1.51'

This commit is contained in:
Tulir Asokan 2022-01-21 15:58:03 +02:00
commit 50ad805804
135 changed files with 2564 additions and 1648 deletions

View file

@ -393,7 +393,9 @@ class RoomCreationHandler:
user_id = requester.user.to_string()
if not await self.spam_checker.user_may_create_room(user_id):
raise SynapseError(403, "You are not permitted to create rooms")
raise SynapseError(
403, "You are not permitted to create rooms", Codes.FORBIDDEN
)
creation_content: JsonDict = {
"room_version": new_room_version.identifier,
@ -685,7 +687,9 @@ class RoomCreationHandler:
invite_3pid_list,
)
):
raise SynapseError(403, "You are not permitted to create rooms")
raise SynapseError(
403, "You are not permitted to create rooms", Codes.FORBIDDEN
)
if ratelimit:
await self.request_ratelimiter.ratelimit(requester)
@ -1187,6 +1191,22 @@ class RoomContextHandler:
# `filtered` rather than the event we retrieved from the datastore.
results["event"] = filtered[0]
# Fetch the aggregations.
aggregations = await self.store.get_bundled_aggregations(
[results["event"]], user.to_string()
)
aggregations.update(
await self.store.get_bundled_aggregations(
results["events_before"], user.to_string()
)
)
aggregations.update(
await self.store.get_bundled_aggregations(
results["events_after"], user.to_string()
)
)
results["aggregations"] = aggregations
if results["events_after"]:
last_event_id = results["events_after"][-1].event_id
else: