From c11a40e0547dff0eb3822f59b1e86917c8af34f1 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sat, 31 Oct 2020 14:22:40 +0100 Subject: [PATCH] Add a room to search a team --- .../management/commands/fix_matrix_channels.py | 13 +++++++++++++ apps/registration/signals.py | 2 ++ 2 files changed, 15 insertions(+) diff --git a/apps/participation/management/commands/fix_matrix_channels.py b/apps/participation/management/commands/fix_matrix_channels.py index 5aaec5c..427cc8b 100644 --- a/apps/participation/management/commands/fix_matrix_channels.py +++ b/apps/participation/management/commands/fix_matrix_channels.py @@ -45,14 +45,27 @@ class Command(BaseCommand): preset=RoomPreset.public_chat, ) + if not async_to_sync(Matrix.resolve_room_alias)("#je-cherche-une-equipe:correspondances-maths.fr"): + Matrix.create_room( + visibility=RoomVisibility.public, + alias="je-cherche-une-equipe", + name="Je cherche une équipe", + topic="Le Tinder des Correspondances", + federate=False, + preset=RoomPreset.public_chat, + ) + Matrix.set_room_avatar("#annonces:correspondances-maths.fr", avatar_uri) Matrix.set_room_avatar("#faq:correspondances-maths.fr", avatar_uri) + Matrix.set_room_avatar("#je-cherche-une-equipe:correspondances-maths.fr", avatar_uri) Matrix.set_room_power_level_event("#annonces:correspondances-maths.fr", "events_default", 50) for r in Registration.objects.all(): Matrix.invite("#annonces:correspondances-maths.fr", f"@{r.matrix_username}:correspondances-maths.fr") Matrix.invite("#faq:correspondances-maths.fr", f"@{r.matrix_username}:correspondances-maths.fr") + Matrix.invite("#je-cherche-une-equipe:correspondances-maths.fr", + f"@{r.matrix_username}:correspondances-maths.fr") for admin in AdminRegistration.objects.all(): Matrix.set_room_power_level("#annonces:correspondances-maths.fr", diff --git a/apps/registration/signals.py b/apps/registration/signals.py index 78d9dfa..3a4c7a3 100644 --- a/apps/registration/signals.py +++ b/apps/registration/signals.py @@ -48,3 +48,5 @@ def invite_to_public_rooms(instance: Registration, **_): if not instance.pk: Matrix.invite("#annonces:correspondances-maths.fr", f"@{instance.matrix_username}:correspondances-maths.fr") Matrix.invite("#faq:correspondances-maths.fr", f"@{instance.matrix_username}:correspondances-maths.fr") + Matrix.invite("#je-cherche-une-equip:correspondances-maths.fr", + f"@{instance.matrix_username}:correspondances-maths.fr")