1 files changed, 27 insertions, 1 deletions
diff --git a/synapse/synapse_rust/events.pyi b/synapse/synapse_rust/events.pyi
index 1682d0d151..7d3422572d 100644
--- a/synapse/synapse_rust/events.pyi
+++ b/synapse/synapse_rust/events.pyi
@@ -10,7 +10,7 @@
# See the GNU Affero General Public License for more details:
# <https://www.gnu.org/licenses/agpl-3.0.html>.
-from typing import Optional
+from typing import List, Mapping, Optional, Tuple
from synapse.types import JsonDict
@@ -105,3 +105,29 @@ class EventInternalMetadata:
def is_notifiable(self) -> bool:
"""Whether this event can trigger a push notification"""
+
+def event_visible_to_server(
+ sender: str,
+ target_server_name: str,
+ history_visibility: str,
+ erased_senders: Mapping[str, bool],
+ partial_state_invisible: bool,
+ memberships: List[Tuple[str, str]],
+) -> bool:
+ """Determine whether the server is allowed to see the unredacted event.
+
+ Args:
+ sender: The sender of the event.
+ target_server_name: The server we want to send the event to.
+ history_visibility: The history_visibility value at the event.
+ erased_senders: A mapping of users and whether they have requested erasure. If a
+ user is not in the map, it is treated as though they haven't requested erasure.
+ partial_state_invisible: Whether the event should be treated as invisible due to
+ the partial state status of the room.
+ memberships: A list of membership state information at the event for users
+ matching the `target_server_name`. Each list item must contain a tuple of
+ (state_key, membership).
+
+ Returns:
+ Whether the server is allowed to see the unredacted event.
+ """
|