Implement group join API

This commit is contained in:
David Baker 2018-03-28 17:18:02 +01:00 committed by Luke Barnard
parent 35ff941172
commit b370fe61c0
5 changed files with 124 additions and 4 deletions

View file

@ -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