diff options
author | Werner Sembach <werner.sembach@fau.de> | 2019-12-16 13:12:40 +0100 |
---|---|---|
committer | Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> | 2019-12-16 12:12:40 +0000 |
commit | 9d173b312cc3ab170de3a7c58ac24778eddf93f6 (patch) | |
tree | c42971aa1e2cb4e7d278b5d1d4d8de329feff675 /synapse/groups | |
parent | Document Shutdown Room admin API (#6541) (diff) | |
download | synapse-9d173b312cc3ab170de3a7c58ac24778eddf93f6.tar.xz |
Automatically delete empty groups/communities (#6453)
Signed-off-by: Werner Sembach <werner.sembach@fau.de>
Diffstat (limited to 'synapse/groups')
-rw-r--r-- | synapse/groups/groups_server.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/synapse/groups/groups_server.py b/synapse/groups/groups_server.py index 29e8ffc295..0ec9be3cb5 100644 --- a/synapse/groups/groups_server.py +++ b/synapse/groups/groups_server.py @@ -773,6 +773,11 @@ class GroupsServerHandler(object): if not self.hs.is_mine_id(user_id): yield self.store.maybe_delete_remote_profile_cache(user_id) + # Delete group if the last user has left + users = yield self.store.get_users_in_group(group_id, include_private=True) + if not users: + yield self.store.delete_group(group_id) + return {} @defer.inlineCallbacks |