summary refs log tree commit diff
path: root/synapse/federation/transport
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2017-08-21 16:51:56 +0100
committerGitHub <noreply@github.com>2017-08-21 16:51:56 +0100
commit2800983f3e81e3baa7dc45e4376a1f8a037097d7 (patch)
tree50070a4113aa75752802af7bbf0b9bb00fa877d0 /synapse/federation/transport
parentMerge pull request #2426 from matrix-org/erikj/groups_fix_sync (diff)
parentUse BOOLEAN rather than TEXT type (diff)
downloadsynapse-2800983f3e81e3baa7dc45e4376a1f8a037097d7.tar.xz
Merge pull request #2410 from matrix-org/erikj/groups_publicise
Add ability to publicise group membership
Diffstat (limited to 'synapse/federation/transport')
-rw-r--r--synapse/federation/transport/client.py15
-rw-r--r--synapse/federation/transport/server.py17
2 files changed, 32 insertions, 0 deletions
diff --git a/synapse/federation/transport/client.py b/synapse/federation/transport/client.py
index 073d3abb2a..ce68cc4937 100644
--- a/synapse/federation/transport/client.py
+++ b/synapse/federation/transport/client.py
@@ -812,3 +812,18 @@ class TransportLayerClient(object):
             args={"requester_user_id": requester_user_id},
             ignore_backoff=True,
         )
+
+    def bulk_get_publicised_groups(self, destination, user_ids):
+        """Get the groups a list of users are publicising
+        """
+
+        path = PREFIX + "/get_groups_publicised"
+
+        content = {"user_ids": user_ids}
+
+        return self.client.post_json(
+            destination=destination,
+            path=path,
+            data=content,
+            ignore_backoff=True,
+        )
diff --git a/synapse/federation/transport/server.py b/synapse/federation/transport/server.py
index e04750fd2a..b5f07c50bf 100644
--- a/synapse/federation/transport/server.py
+++ b/synapse/federation/transport/server.py
@@ -1050,6 +1050,22 @@ class FederationGroupsSummaryUsersServlet(BaseFederationServlet):
         defer.returnValue((200, resp))
 
 
+class FederationGroupsBulkPublicisedServlet(BaseFederationServlet):
+    """Get roles in a group
+    """
+    PATH = (
+        "/get_groups_publicised$"
+    )
+
+    @defer.inlineCallbacks
+    def on_POST(self, origin, content, query):
+        resp = yield self.handler.bulk_get_publicised_groups(
+            content["user_ids"], proxy=False,
+        )
+
+        defer.returnValue((200, resp))
+
+
 FEDERATION_SERVLET_CLASSES = (
     FederationSendServlet,
     FederationPullServlet,
@@ -1102,6 +1118,7 @@ GROUP_SERVER_SERVLET_CLASSES = (
 GROUP_LOCAL_SERVLET_CLASSES = (
     FederationGroupsLocalInviteServlet,
     FederationGroupsRemoveLocalUserServlet,
+    FederationGroupsBulkPublicisedServlet,
 )