Fixup
This commit is contained in:
parent
ef8e578677
commit
ba3ff7918b
|
@ -329,27 +329,31 @@ class GroupsLocalHandler(object):
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def bulk_get_publicised_groups(self, user_ids, proxy=True):
|
def bulk_get_publicised_groups(self, user_ids, proxy=True):
|
||||||
destinations = {}
|
destinations = {}
|
||||||
locals = []
|
local_users = set()
|
||||||
|
|
||||||
for user_id in user_ids:
|
for user_id in user_ids:
|
||||||
if self.hs.is_mine_id(user_id):
|
if self.hs.is_mine_id(user_id):
|
||||||
locals.append(user_id)
|
local_users.add(user_id)
|
||||||
else:
|
else:
|
||||||
destinations.setdefault(
|
destinations.setdefault(
|
||||||
get_domain_from_id(user_id), []
|
get_domain_from_id(user_id), set()
|
||||||
).append(user_id)
|
).add(user_id)
|
||||||
|
|
||||||
if not proxy and destinations:
|
if not proxy and destinations:
|
||||||
raise SynapseError(400, "Some user_ids are not local")
|
raise SynapseError(400, "Some user_ids are not local")
|
||||||
|
|
||||||
results = {}
|
results = {}
|
||||||
|
failed_results = []
|
||||||
for destination, dest_user_ids in destinations.iteritems():
|
for destination, dest_user_ids in destinations.iteritems():
|
||||||
|
try:
|
||||||
r = yield self.transport_client.bulk_get_publicised_groups(
|
r = yield self.transport_client.bulk_get_publicised_groups(
|
||||||
destination, dest_user_ids,
|
destination, list(dest_user_ids),
|
||||||
)
|
)
|
||||||
results.update(r)
|
results.update(r["users"])
|
||||||
|
except Exception:
|
||||||
|
failed_results.extend(dest_user_ids)
|
||||||
|
|
||||||
for uid in locals:
|
for uid in local_users:
|
||||||
results[uid] = yield self.store.get_publicised_groups_for_user(
|
results[uid] = yield self.store.get_publicised_groups_for_user(
|
||||||
uid
|
uid
|
||||||
)
|
)
|
||||||
|
|
|
@ -681,3 +681,4 @@ def register_servlets(hs, http_server):
|
||||||
GroupSelfUpdatePublicityServlet(hs).register(http_server)
|
GroupSelfUpdatePublicityServlet(hs).register(http_server)
|
||||||
GroupSummaryUsersRoleServlet(hs).register(http_server)
|
GroupSummaryUsersRoleServlet(hs).register(http_server)
|
||||||
PublicisedGroupsForUserServlet(hs).register(http_server)
|
PublicisedGroupsForUserServlet(hs).register(http_server)
|
||||||
|
PublicisedGroupsForUsersServlet(hs).register(http_server)
|
||||||
|
|
Loading…
Reference in New Issue