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

Commit

Permalink
Don't worry about setting creator for invite
Browse files Browse the repository at this point in the history
  • Loading branch information
MadLittleMods committed Aug 25, 2021
1 parent 9f8e22b commit 3c9b5a6
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions synapse/storage/databases/main/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -1440,6 +1440,11 @@ async def upsert_room_on_join(

room_creator = create_event.content.get("creator", None)

if room_creator is None:
# If the create event does not have a creator then the room is
# invalid, and it would fail auth checks anyway.
raise StoreError(400, "No creator defined on the create event")

await self.db_pool.simple_upsert(
desc="upsert_room_on_join",
table="rooms",
Expand Down Expand Up @@ -1467,9 +1472,6 @@ async def maybe_store_room_on_outlier_membership(
# mark the room as having an auth chain cover index.
has_auth_chain_index = await self.has_auth_chain_index(room_id)

create_event = await self.get_create_event_for_room(room_id)
room_creator = create_event.content.get("creator", None)

await self.db_pool.simple_upsert(
desc="maybe_store_room_on_outlier_membership",
table="rooms",
Expand All @@ -1478,7 +1480,10 @@ async def maybe_store_room_on_outlier_membership(
insertion_values={
"room_version": room_version.identifier,
"is_public": False,
"creator": room_creator,
# We don't worry about setting the `creator` here because
# we don't process any messages in a room while a user is
# invited (only after the join).
"creator": "",
"has_auth_chain_index": has_auth_chain_index,
},
# rooms has a unique constraint on room_id, so no need to lock when doing an
Expand Down

0 comments on commit 3c9b5a6

Please sign in to comment.