summary refs log tree commit diff
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2024-04-18 14:58:57 +0100
committerRichard van der Hoff <richard@matrix.org>2024-04-18 14:58:57 +0100
commitd27023b415c5a0da32573c08b1afd6943488e153 (patch)
tree4654d46501d62b5efb684ea78677525627ddb9c7
parentHelpers to transform Twisted requests to Rust http Requests/Responses (#17081) (diff)
downloadsynapse-d27023b415c5a0da32573c08b1afd6943488e153.tar.xz
Remove tautologous test, and fix up doc-comments
We've just checked `membership=="leave"` here, so clearly it's not join.
-rw-r--r--synapse/visibility.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/synapse/visibility.py b/synapse/visibility.py
index d1d478129f..4be4ac81e7 100644
--- a/synapse/visibility.py
+++ b/synapse/visibility.py
@@ -396,9 +396,13 @@ def _check_client_allowed_to_see_event(
 
 @attr.s(frozen=True, slots=True, auto_attribs=True)
 class _CheckMembershipReturn:
-    "Return value of _check_membership"
+    """Return value of _check_membership"""
+
     allowed: bool
+    """Whether the user should be allowed to see the event"""
+
     joined: bool
+    """Whether the user was joined at the event"""
 
 
 def _check_membership(
@@ -409,10 +413,6 @@ def _check_membership(
     is_peeking: bool,
 ) -> _CheckMembershipReturn:
     """Check whether the user can see the event due to their membership
-
-    Returns:
-        True if they can, False if they can't, plus the membership of the user
-        at the event.
     """
     # If the event is the user's own membership event, use the 'most joined'
     # membership
@@ -435,7 +435,7 @@ def _check_membership(
         if membership == "leave" and (
             prev_membership == "join" or prev_membership == "invite"
         ):
-            return _CheckMembershipReturn(True, membership == Membership.JOIN)
+            return _CheckMembershipReturn(True, False)
 
         new_priority = MEMBERSHIP_PRIORITY.index(membership)
         old_priority = MEMBERSHIP_PRIORITY.index(prev_membership)