diff options
author | David Baker <dave@matrix.org> | 2018-03-28 14:03:37 +0100 |
---|---|---|
committer | David Baker <dave@matrix.org> | 2018-03-28 14:03:37 +0100 |
commit | 79452edeee94a09a826ee2b41a08811b823a3ad6 (patch) | |
tree | bdaa7170826c96481040394a679e5970f9d69d85 /synapse/groups/groups_server.py | |
parent | fix typo (diff) | |
download | synapse-79452edeee94a09a826ee2b41a08811b823a3ad6.tar.xz |
Add joinability for groups
Adds API to set the 'joinable' flag, and corresponding flag in the table.
Diffstat (limited to 'synapse/groups/groups_server.py')
-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 0b995aed70..25cbfb1691 100644 --- a/synapse/groups/groups_server.py +++ b/synapse/groups/groups_server.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # Copyright 2017 Vector Creations Ltd +# Copyright 2018 New Vector Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -206,6 +207,24 @@ class GroupsServerHandler(object): defer.returnValue({}) @defer.inlineCallbacks + def set_group_joinable(self, group_id, requester_user_id, content): + """Sets whether a group is joinable without an invite or knock + """ + yield self.check_group_is_ours( + group_id, requester_user_id, and_exists=True, and_is_admin=requester_user_id + ) + + is_joinable = content.get('joinable') + if is_joinable is None: + raise SynapseError( + 400, "No value specified for 'joinable'" + ) + + yield self.store.set_group_joinable(group_id, is_joinable=is_joinable) + + defer.returnValue({}) + + @defer.inlineCallbacks def get_group_categories(self, group_id, requester_user_id): """Get all categories in a group (as seen by user) """ |