summary refs log tree commit diff
path: root/synapse/events/__init__.py
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2019-01-29 23:07:00 +0000
committerGitHub <noreply@github.com>2019-01-29 23:07:00 +0000
commite12313ba2571c8e416136b9eb1e6620504d9a113 (patch)
treeb62b1658804c8f76cde6f5a9d24e7aff3af56438 /synapse/events/__init__.py
parentMerge pull request #4514 from matrix-org/erikj/remove_event_id (diff)
parentMerge branch 'develop' of github.com:matrix-org/synapse into erikj/redactions... (diff)
downloadsynapse-e12313ba2571c8e416136b9eb1e6620504d9a113.tar.xz
Merge pull request #4499 from matrix-org/erikj/redactions_eiah
Implement rechecking of redactions for room versions v3
Diffstat (limited to 'synapse/events/__init__.py')
-rw-r--r--synapse/events/__init__.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/synapse/events/__init__.py b/synapse/events/__init__.py
index 627c55c404..697cf58582 100644
--- a/synapse/events/__init__.py
+++ b/synapse/events/__init__.py
@@ -62,6 +62,21 @@ class _EventInternalMetadata(object):
         """
         return getattr(self, "send_on_behalf_of", None)
 
+    def need_to_check_redaction(self):
+        """Whether the redaction event needs to be rechecked when fetching
+        from the database.
+
+        Starting in room v3 redaction events are accepted up front, and later
+        checked to see if the redacter and redactee's domains match.
+
+        If the sender of the redaction event is allowed to redact any event
+        due to auth rules, then this will always return false.
+
+        Returns:
+            bool
+        """
+        return getattr(self, "recheck_redaction", False)
+
 
 def _event_dict_property(key):
     # We want to be able to use hasattr with the event dict properties.
@@ -328,8 +343,7 @@ def room_version_to_event_format(room_version):
         raise RuntimeError("Unrecognized room version %s" % (room_version,))
 
     if room_version in (
-        RoomVersions.V1, RoomVersions.V2, RoomVersions.VDH_TEST,
-        RoomVersions.STATE_V2_TEST,
+        RoomVersions.V1, RoomVersions.V2, RoomVersions.STATE_V2_TEST,
     ):
         return EventFormatVersions.V1
     else: