summary refs log tree commit diff
path: root/synapse/storage/event_federation.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-04-04 11:56:40 +0100
committerErik Johnston <erik@matrix.org>2016-04-04 11:56:40 +0100
commitbf14883a04c702a553cc81b3f4ee66608be663fa (patch)
treef29ab95ef6fab9ef87a7f7f67226ad472474262c /synapse/storage/event_federation.py
parentMerge pull request #686 from matrix-org/markjh/doc_strings (diff)
parentUse computed prev event ids (diff)
downloadsynapse-bf14883a04c702a553cc81b3f4ee66608be663fa.tar.xz
Merge pull request #689 from matrix-org/erikj/member
Do checks for memberships before creating events
Diffstat (limited to 'synapse/storage/event_federation.py')
-rw-r--r--synapse/storage/event_federation.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/synapse/storage/event_federation.py b/synapse/storage/event_federation.py
index 3489315e0d..0827946207 100644
--- a/synapse/storage/event_federation.py
+++ b/synapse/storage/event_federation.py
@@ -163,6 +163,22 @@ class EventFederationStore(SQLBaseStore):
             room_id,
         )
 
+    @defer.inlineCallbacks
+    def get_max_depth_of_events(self, event_ids):
+        sql = (
+            "SELECT MAX(depth) FROM events WHERE event_id IN (%s)"
+        ) % (",".join(["?"] * len(event_ids)),)
+
+        rows = yield self._execute(
+            "get_max_depth_of_events", None,
+            sql, *event_ids
+        )
+
+        if rows:
+            defer.returnValue(rows[0][0])
+        else:
+            defer.returnValue(1)
+
     def _get_min_depth_interaction(self, txn, room_id):
         min_depth = self._simple_select_one_onecol_txn(
             txn,