summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2018-03-28 17:18:02 +0100
committerLuke Barnard <luke@matrix.org>2018-04-06 15:43:27 +0100
commitb370fe61c0aeccac7745ad404dad925ec217ba6d (patch)
tree97db3befb8b085f181aef7b434752ea02a1f9b55 /synapse/storage
parentMerge pull request #3070 from krombel/group_join_put_instead_post (diff)
downloadsynapse-b370fe61c0aeccac7745ad404dad925ec217ba6d.tar.xz
Implement group join API
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/group_server.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/synapse/storage/group_server.py b/synapse/storage/group_server.py
index db316a27ec..16c11a056f 100644
--- a/synapse/storage/group_server.py
+++ b/synapse/storage/group_server.py
@@ -48,19 +48,25 @@ class GroupServerStore(SQLBaseStore):
             desc="set_group_join_policy",
         )
 
+    @defer.inlineCallbacks
     def get_group(self, group_id):
-        return self._simple_select_one(
+        ret = yield self._simple_select_one(
             table="groups",
             keyvalues={
                 "group_id": group_id,
             },
             retcols=(
-                "name", "short_description", "long_description", "avatar_url", "is_public"
+                "name", "short_description", "long_description", "avatar_url", "is_public", "is_joinable",
             ),
             allow_none=True,
-            desc="is_user_in_group",
+            desc="get_group",
         )
 
+        if ret and 'is_joinable' in ret:
+            ret['is_joinable'] = bool(ret['is_joinable'])
+
+        defer.returnValue(ret)
+
     def get_users_in_group(self, group_id, include_private=False):
         # TODO: Pagination