summary refs log tree commit diff
path: root/synapse/groups/groups_server.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2017-07-20 09:46:33 +0100
committerErik Johnston <erik@matrix.org>2017-07-20 09:46:33 +0100
commit6f443a74cf6ab0bfe452289f9888580725987765 (patch)
treec993649ca55493d35e9be821b2768dbee30531df /synapse/groups/groups_server.py
parentComments (diff)
downloadsynapse-6f443a74cf6ab0bfe452289f9888580725987765.tar.xz
Add update group profile API
Diffstat (limited to 'synapse/groups/groups_server.py')
-rw-r--r--synapse/groups/groups_server.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/synapse/groups/groups_server.py b/synapse/groups/groups_server.py
index 1b6e354ca3..322aad2a6f 100644
--- a/synapse/groups/groups_server.py
+++ b/synapse/groups/groups_server.py
@@ -342,6 +342,22 @@ class GroupsServerHandler(object):
             raise SynapseError(404, "Unknown group")
 
     @defer.inlineCallbacks
+    def update_group_profile(self, group_id, requester_user_id, content):
+        """Update the group profile
+        """
+        yield self.check_group_is_ours(
+            group_id, and_exists=True, and_is_admin=requester_user_id,
+        )
+
+        profile = {}
+        for keyname in ("name", "avatar_url", "short_description",
+                        "long_description"):
+            if keyname in content:
+                profile[keyname] = content[keyname]
+
+        yield self.store.update_group_profile(group_id, profile)
+
+    @defer.inlineCallbacks
     def get_users_in_group(self, group_id, requester_user_id):
         """Get the users in group as seen by requester_user_id.