Merge pull request #2471 from matrix-org/erikj/group_summary_publicised

Add is_publicised to group summary
This commit is contained in:
Erik Johnston 2017-09-26 11:33:21 +01:00 committed by GitHub
commit 0d7c7fd907

View File

@ -96,8 +96,7 @@ class GroupsLocalHandler(object):
res = yield self.groups_server_handler.get_group_summary(
group_id, requester_user_id
)
defer.returnValue(res)
else:
res = yield self.transport_client.get_group_summary(
get_domain_from_id(group_id), group_id, requester_user_id,
)
@ -123,6 +122,13 @@ class GroupsLocalHandler(object):
res["users_section"]["users"].sort(key=lambda e: e.get("order", 0))
res["rooms_section"]["rooms"].sort(key=lambda e: e.get("order", 0))
# Add `is_publicised` flag to indicate whether the user has publicised their
# membership of the group on their profile
result = yield self.store.get_publicised_groups_for_user(requester_user_id)
is_publicised = group_id in result
res.setdefault("user", {})["is_publicised"] = is_publicised
defer.returnValue(res)
@defer.inlineCallbacks