summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2018-03-28 14:03:37 +0100
committerDavid Baker <dave@matrix.org>2018-03-28 14:03:37 +0100
commit79452edeee94a09a826ee2b41a08811b823a3ad6 (patch)
treebdaa7170826c96481040394a679e5970f9d69d85 /synapse/storage
parentfix typo (diff)
downloadsynapse-79452edeee94a09a826ee2b41a08811b823a3ad6.tar.xz
Add joinability for groups
Adds API to set the 'joinable' flag, and corresponding flag in the
table.
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/group_server.py13
-rw-r--r--synapse/storage/prepare_database.py3
2 files changed, 15 insertions, 1 deletions
diff --git a/synapse/storage/group_server.py b/synapse/storage/group_server.py
index 8fde1aab8e..96553d4fb1 100644
--- a/synapse/storage/group_server.py
+++ b/synapse/storage/group_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.
@@ -29,6 +30,18 @@ _DEFAULT_ROLE_ID = ""
 
 
 class GroupServerStore(SQLBaseStore):
+    def set_group_joinable(self, group_id, is_joinable):
+        return self._simple_update_one(
+            table="groups",
+            keyvalues={
+                "group_id": group_id,
+            },
+            updatevalues={
+                "is_joinable": is_joinable,
+            },
+            desc="set_group_joinable",
+        )
+
     def get_group(self, group_id):
         return self._simple_select_one(
             table="groups",
diff --git a/synapse/storage/prepare_database.py b/synapse/storage/prepare_database.py
index c845a0cec5..04411a665f 100644
--- a/synapse/storage/prepare_database.py
+++ b/synapse/storage/prepare_database.py
@@ -1,5 +1,6 @@
 # -*- coding: utf-8 -*-
 # Copyright 2014 - 2016 OpenMarket 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.
@@ -25,7 +26,7 @@ logger = logging.getLogger(__name__)
 
 # Remember to update this number every time a change is made to database
 # schema files, so the users will be informed on server restarts.
-SCHEMA_VERSION = 47
+SCHEMA_VERSION = 48
 
 dir_path = os.path.abspath(os.path.dirname(__file__))