summary refs log tree commit diff
path: root/synapse/rest
diff options
context:
space:
mode:
authorLuke Barnard <lukebarnard1@users.noreply.github.com>2017-10-16 17:33:33 +0200
committerGitHub <noreply@github.com>2017-10-16 17:33:33 +0200
commite0a75e0c253321bca6f00f79815eac11ce003988 (patch)
tree68e666ef8c0c3f478aba9dab51c1d7c66cad9f5b /synapse/rest
parentMerge pull request #2543 from matrix-org/luke/fix-on-group-invite-no-profile (diff)
parentDelint (diff)
downloadsynapse-e0a75e0c253321bca6f00f79815eac11ce003988.tar.xz
Merge pull request #2544 from matrix-org/luke/groups-invited-users
 Implement GET /groups/$groupId/invited_users
Diffstat (limited to 'synapse/rest')
-rw-r--r--synapse/rest/client/v2_alpha/groups.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/synapse/rest/client/v2_alpha/groups.py b/synapse/rest/client/v2_alpha/groups.py
index 8f3ce15b02..d11bccc1da 100644
--- a/synapse/rest/client/v2_alpha/groups.py
+++ b/synapse/rest/client/v2_alpha/groups.py
@@ -371,6 +371,27 @@ 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 +695,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)