diff options
author | Erik Johnston <erikj@jki.re> | 2017-07-20 17:53:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-20 17:53:39 +0100 |
commit | 04016042222c89dc604b8fb1b0e87ad4114a4a12 (patch) | |
tree | 825537967b4fd6f8992d9d79fd0f1dc78cd4a3b0 /synapse/groups | |
parent | Merge pull request #2374 from matrix-org/erikj/group_server_local (diff) | |
parent | Remove spurious content param (diff) | |
download | synapse-04016042222c89dc604b8fb1b0e87ad4114a4a12.tar.xz |
Merge pull request #2377 from matrix-org/erikj/group_profile_update
Add update group profile API
Diffstat (limited to 'synapse/groups')
-rw-r--r-- | synapse/groups/groups_server.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/synapse/groups/groups_server.py b/synapse/groups/groups_server.py index 1b6e354ca3..b1ee43ef90 100644 --- a/synapse/groups/groups_server.py +++ b/synapse/groups/groups_server.py @@ -342,6 +342,25 @@ 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: + value = content[keyname] + if not isinstance(value, basestring): + raise SynapseError(400, "%r value is not a string" % (keyname,)) + profile[keyname] = value + + 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. |