1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-02-12 09:41:18 +00:00

Compare commits

...

3 Commits

Author SHA1 Message Date
Yohann D'ANELLO
ece1e800ab Add #flood 2020-11-15 01:29:53 +01:00
Yohann D'ANELLO
2e0028c063 Send display name to Matrix 2020-11-15 01:14:31 +01:00
Yohann D'ANELLO
d304c3565c resolve_room_alias was broken 2020-11-15 00:55:25 +01:00
4 changed files with 25 additions and 1 deletions

View File

@ -56,9 +56,20 @@ class Command(BaseCommand):
preset=RoomPreset.public_chat, preset=RoomPreset.public_chat,
) )
if not async_to_sync(Matrix.resolve_room_alias)("#flood:correspondances-maths.fr"):
Matrix.create_room(
visibility=RoomVisibility.public,
alias="flood",
name="Flood",
topic="Discutez de tout et de rien !",
federate=False,
preset=RoomPreset.public_chat,
)
Matrix.set_room_avatar("#annonces:correspondances-maths.fr", avatar_uri) Matrix.set_room_avatar("#annonces:correspondances-maths.fr", avatar_uri)
Matrix.set_room_avatar("#faq: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_avatar("#je-cherche-une-equipe:correspondances-maths.fr", avatar_uri)
Matrix.set_room_avatar("#flood:correspondances-maths.fr", avatar_uri)
Matrix.set_room_power_level_event("#annonces:correspondances-maths.fr", "events_default", 50) Matrix.set_room_power_level_event("#annonces:correspondances-maths.fr", "events_default", 50)
@ -67,9 +78,12 @@ class Command(BaseCommand):
Matrix.invite("#faq: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", Matrix.invite("#je-cherche-une-equipe:correspondances-maths.fr",
f"@{r.matrix_username}:correspondances-maths.fr") f"@{r.matrix_username}:correspondances-maths.fr")
Matrix.invite("#flood:correspondances-maths.fr", f"@{r.matrix_username}:correspondances-maths.fr")
for admin in AdminRegistration.objects.all(): for admin in AdminRegistration.objects.all():
Matrix.set_room_power_level("#annonces:correspondances-maths.fr", Matrix.set_room_power_level("#annonces:correspondances-maths.fr",
f"@{admin.matrix_username}:correspondances-maths.fr", 95) f"@{admin.matrix_username}:correspondances-maths.fr", 95)
Matrix.set_room_power_level("#faq:correspondances-maths.fr", Matrix.set_room_power_level("#faq:correspondances-maths.fr",
f"@{admin.matrix_username}:correspondances-maths.fr", 95) f"@{admin.matrix_username}:correspondances-maths.fr", 95)
Matrix.set_room_power_level("#flood:correspondances-maths.fr",
f"@{admin.matrix_username}:correspondances-maths.fr", 95)

View File

@ -13,5 +13,14 @@
"single_log_out": true, "single_log_out": true,
"single_log_out_callback": "" "single_log_out_callback": ""
} }
},
{
"model": "cas_server.replaceattributname",
"pk": 1,
"fields": {
"name": "display_name",
"replace": "",
"service_pattern": 1
}
} }
] ]

View File

@ -50,3 +50,4 @@ def invite_to_public_rooms(instance: Registration, created: bool, **_):
Matrix.invite("#faq: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", Matrix.invite("#je-cherche-une-equip:correspondances-maths.fr",
f"@{instance.matrix_username}:correspondances-maths.fr") f"@{instance.matrix_username}:correspondances-maths.fr")
Matrix.invite("#flood:correspondances-maths.fr", f"@{instance.matrix_username}:correspondances-maths.fr")

View File

@ -216,7 +216,7 @@ class Matrix:
""" """
client = await cls._get_client() client = await cls._get_client()
resp = await client.room_resolve_alias(room_alias) resp = await client.room_resolve_alias(room_alias)
return resp.room_id if resp else None return resp.room_id if resp and hasattr(resp, "room_id") else None
@classmethod @classmethod
@async_to_sync @async_to_sync