summary refs log tree commit diff
path: root/synapse/storage/_base.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-01-22 15:50:17 +0000
committerErik Johnston <erik@matrix.org>2015-01-22 15:50:17 +0000
commitb1b85753d759f7127fbb1c4a95005fffd3da7f4d (patch)
treecbfcc00e0001fd7eeb20de92190f4b411f052e7f /synapse/storage/_base.py
parentRemove unused function. Add comment. (diff)
downloadsynapse-b1b85753d759f7127fbb1c4a95005fffd3da7f4d.tar.xz
Add support for storing rejected events in EventContext and data stores
Diffstat (limited to 'synapse/storage/_base.py')
-rw-r--r--synapse/storage/_base.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/synapse/storage/_base.py b/synapse/storage/_base.py
index f660fc6eaf..2075a018b2 100644
--- a/synapse/storage/_base.py
+++ b/synapse/storage/_base.py
@@ -458,10 +458,12 @@ class SQLBaseStore(object):
         return [e for e in events if e]
 
     def _get_event_txn(self, txn, event_id, check_redacted=True,
-                       get_prev_content=False):
+                       get_prev_content=False, allow_rejected=False):
         sql = (
-            "SELECT internal_metadata, json, r.event_id FROM event_json as e "
+            "SELECT internal_metadata, json, r.event_id, reason "
+            "FROM event_json as e "
             "LEFT JOIN redactions as r ON e.event_id = r.redacts "
+            "LEFT JOIN rejections as rej on rej.event_id = e.event_id  "
             "WHERE e.event_id = ? "
             "LIMIT 1 "
         )
@@ -473,13 +475,16 @@ class SQLBaseStore(object):
         if not res:
             return None
 
-        internal_metadata, js, redacted = res
+        internal_metadata, js, redacted, rejected_reason = res
 
-        return self._get_event_from_row_txn(
-            txn, internal_metadata, js, redacted,
-            check_redacted=check_redacted,
-            get_prev_content=get_prev_content,
-        )
+        if allow_rejected or not rejected_reason:
+            return self._get_event_from_row_txn(
+                txn, internal_metadata, js, redacted,
+                check_redacted=check_redacted,
+                get_prev_content=get_prev_content,
+            )
+        else:
+            return None
 
     def _get_event_from_row_txn(self, txn, internal_metadata, js, redacted,
                                 check_redacted=True, get_prev_content=False):