summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2017-08-08 11:50:09 +0100
committerErik Johnston <erik@matrix.org>2017-08-08 13:01:46 +0100
commit05e21285aae4a0411a9ec1151ce006297fa3ca91 (patch)
tree5a28f0ca22be50d0768406c826a6123d163dc7b2 /synapse
parentRemove stale TODO comments (diff)
downloadsynapse-05e21285aae4a0411a9ec1151ce006297fa3ca91.tar.xz
Store whether the user wants to publicise their membership of a group
Diffstat (limited to 'synapse')
-rw-r--r--synapse/handlers/groups_local.py4
-rw-r--r--synapse/storage/group_server.py2
-rw-r--r--synapse/storage/schema/delta/43/group_server.sql1
3 files changed, 7 insertions, 0 deletions
diff --git a/synapse/handlers/groups_local.py b/synapse/handlers/groups_local.py
index b8b1e754c7..3a738ef36f 100644
--- a/synapse/handlers/groups_local.py
+++ b/synapse/handlers/groups_local.py
@@ -203,12 +203,16 @@ class GroupsLocalHandler(object):
                 user_id=user_id,
             )
 
+        # TODO: Check that the group is public and we're being added publically
+        is_publicised = content.get("publicise", False)
+
         token = yield self.store.register_user_group_membership(
             group_id, user_id,
             membership="join",
             is_admin=False,
             local_attestation=local_attestation,
             remote_attestation=remote_attestation,
+            is_publicised=is_publicised,
         )
         self.notifier.on_new_event(
             "groups_key", token, users=[user_id],
diff --git a/synapse/storage/group_server.py b/synapse/storage/group_server.py
index f44e80b514..31514f3cdb 100644
--- a/synapse/storage/group_server.py
+++ b/synapse/storage/group_server.py
@@ -840,6 +840,7 @@ class GroupServerStore(SQLBaseStore):
                                        is_admin=False, content={},
                                        local_attestation=None,
                                        remote_attestation=None,
+                                       is_publicised=False,
                                        ):
         """Registers that a local user is a member of a (local or remote) group.
 
@@ -873,6 +874,7 @@ class GroupServerStore(SQLBaseStore):
                     "user_id": user_id,
                     "is_admin": is_admin,
                     "membership": membership,
+                    "is_publicised": is_publicised,
                     "content": json.dumps(content),
                 },
             )
diff --git a/synapse/storage/schema/delta/43/group_server.sql b/synapse/storage/schema/delta/43/group_server.sql
index 92f3339c94..01ac0edc35 100644
--- a/synapse/storage/schema/delta/43/group_server.sql
+++ b/synapse/storage/schema/delta/43/group_server.sql
@@ -150,6 +150,7 @@ CREATE TABLE local_group_membership (
     user_id TEXT NOT NULL,
     is_admin BOOLEAN NOT NULL,
     membership TEXT NOT NULL,
+    is_publicised TEXT NOT NULL,  -- if the user is publicising their membership
     content TEXT NOT NULL
 );