summary refs log tree commit diff
path: root/synapse/rest/client
diff options
context:
space:
mode:
authorLuke Barnard <lukeb@openmarket.com>2017-10-16 15:31:11 +0100
committerLuke Barnard <lukeb@openmarket.com>2017-10-16 15:31:11 +0100
commit2c5972f87f0541aaeff43846f7050ab91d11cf0e (patch)
tree9d58fc7426e62ed576a4ede3f8a59d9825025dec /synapse/rest/client
parentLog a warning when no profile for invited member (diff)
downloadsynapse-2c5972f87f0541aaeff43846f7050ab91d11cf0e.tar.xz
Implement GET /groups/$groupId/invited_users
Diffstat (limited to 'synapse/rest/client')
-rw-r--r--synapse/rest/client/v2_alpha/groups.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/synapse/rest/client/v2_alpha/groups.py b/synapse/rest/client/v2_alpha/groups.py
index 8f3ce15b02..4532112cfc 100644
--- a/synapse/rest/client/v2_alpha/groups.py
+++ b/synapse/rest/client/v2_alpha/groups.py
@@ -370,6 +370,26 @@ class GroupUsersServlet(RestServlet):
 
         defer.returnValue((200, result))
 
+class GroupInvitedUsersServlet(RestServlet):
+    """Get users invited to a group
+    """
+    PATTERNS = client_v2_patterns("/groups/(?P<group_id>[^/]*)/invited_users$")
+
+    def __init__(self, hs):
+        super(GroupInvitedUsersServlet, self).__init__()
+        self.auth = hs.get_auth()
+        self.clock = hs.get_clock()
+        self.groups_handler = hs.get_groups_local_handler()
+
+    @defer.inlineCallbacks
+    def on_GET(self, request, group_id):
+        requester = yield self.auth.get_user_by_req(request)
+        user_id = requester.user.to_string()
+
+        result = yield self.groups_handler.get_invited_users_in_group(group_id, user_id)
+
+        defer.returnValue((200, result))
+
 
 class GroupCreateServlet(RestServlet):
     """Create a group
@@ -674,6 +694,7 @@ class GroupsForUserServlet(RestServlet):
 def register_servlets(hs, http_server):
     GroupServlet(hs).register(http_server)
     GroupSummaryServlet(hs).register(http_server)
+    GroupInvitedUsersServlet(hs).register(http_server)
     GroupUsersServlet(hs).register(http_server)
     GroupRoomServlet(hs).register(http_server)
     GroupCreateServlet(hs).register(http_server)