Store whether the user wants to publicise their membership of a group

This commit is contained in:
Erik Johnston 2017-08-08 11:50:09 +01:00
parent a1e67bcb97
commit 05e21285aa
3 changed files with 7 additions and 0 deletions

View File

@ -203,12 +203,16 @@ class GroupsLocalHandler(object):
user_id=user_id, 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( token = yield self.store.register_user_group_membership(
group_id, user_id, group_id, user_id,
membership="join", membership="join",
is_admin=False, is_admin=False,
local_attestation=local_attestation, local_attestation=local_attestation,
remote_attestation=remote_attestation, remote_attestation=remote_attestation,
is_publicised=is_publicised,
) )
self.notifier.on_new_event( self.notifier.on_new_event(
"groups_key", token, users=[user_id], "groups_key", token, users=[user_id],

View File

@ -840,6 +840,7 @@ class GroupServerStore(SQLBaseStore):
is_admin=False, content={}, is_admin=False, content={},
local_attestation=None, local_attestation=None,
remote_attestation=None, remote_attestation=None,
is_publicised=False,
): ):
"""Registers that a local user is a member of a (local or remote) group. """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, "user_id": user_id,
"is_admin": is_admin, "is_admin": is_admin,
"membership": membership, "membership": membership,
"is_publicised": is_publicised,
"content": json.dumps(content), "content": json.dumps(content),
}, },
) )

View File

@ -150,6 +150,7 @@ CREATE TABLE local_group_membership (
user_id TEXT NOT NULL, user_id TEXT NOT NULL,
is_admin BOOLEAN NOT NULL, is_admin BOOLEAN NOT NULL,
membership TEXT NOT NULL, membership TEXT NOT NULL,
is_publicised TEXT NOT NULL, -- if the user is publicising their membership
content TEXT NOT NULL content TEXT NOT NULL
); );