Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/19353.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a bug introduced in 1.61.0 where a user's membership in a room was accidentally ignored when considering access to historical state events in rooms with the "shared" history visibility. Contributed by Lukas Tautz.
2 changes: 1 addition & 1 deletion synapse/handlers/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ async def _user_can_see_state_at_event(
current_membership,
_,
) = await self.store.get_local_current_membership_for_user_in_room(
user_id, event_id
user_id, room_id
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could probably catch this better if we enforced keyword args on get_local_current_membership_for_user_in_room(...):

    async def get_local_current_membership_for_user_in_room(
        self, *, user_id: str, room_id: str
    ) -> tuple[str | None, str | None]:

In this usage, we would see room_id=event_id which won't be picked up by the linter but is more obvious to the eyes as a mistake.

Additionally, these are both str args which could be confused on order.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point for making wider use of kwargs!

)
return current_membership == Membership.JOIN

Expand Down