summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2017-08-09 13:36:22 +0100
committerErik Johnston <erik@matrix.org>2017-08-09 13:36:22 +0100
commitef8e5786770ff285ebdf1fce420b5aa86437673c (patch)
tree61cad1a476d1d43cda40162ec4303dc625feb0e8 /synapse/storage
parentAllow update group publicity (diff)
downloadsynapse-ef8e5786770ff285ebdf1fce420b5aa86437673c.tar.xz
Add bulk group publicised lookup API
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/group_server.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/synapse/storage/group_server.py b/synapse/storage/group_server.py
index 10e757e975..0c35b03d2a 100644
--- a/synapse/storage/group_server.py
+++ b/synapse/storage/group_server.py
@@ -835,6 +835,20 @@ class GroupServerStore(SQLBaseStore):
             desc="add_room_to_group",
         )
 
+    def get_publicised_groups_for_user(self, user_id):
+        """Get all groups a user is publicising
+        """
+        return self._simple_select_onecol(
+            table="local_group_membership",
+            keyvalues={
+                "user_id": user_id,
+                "membership": "join",
+                "is_publicised": True,
+            },
+            retcol="group_id",
+            desc="get_publicised_groups_for_user",
+        )
+
     def update_group_publicity(self, group_id, user_id, publicise):
         """Update whether the user is publicising their membership of the group
         """