mirror of
https://gitlab.com/animath/si/plateforme-corres2math.git
synced 2025-06-21 09:58:26 +02:00
Create Matrix room when a Team got created
This commit is contained in:
@ -2,6 +2,7 @@ import os
|
||||
import re
|
||||
|
||||
from django.template.loader import render_to_string
|
||||
from nio import RoomVisibility, RoomPreset
|
||||
|
||||
from corres2math.lists import get_sympa_client
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
@ -14,6 +15,8 @@ from django.utils.crypto import get_random_string
|
||||
from django.utils.text import format_lazy
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from corres2math.matrix import Matrix
|
||||
|
||||
|
||||
class Team(models.Model):
|
||||
name = models.CharField(
|
||||
@ -63,6 +66,13 @@ class Team(models.Model):
|
||||
self.access_code = get_random_string(6)
|
||||
self.create_mailing_list()
|
||||
|
||||
Matrix.create_room(
|
||||
visibility=RoomVisibility.private,
|
||||
alias=f"team-{self.trigram.lower()}",
|
||||
topic=f"Discussion de l'équipe {self.name}",
|
||||
preset=RoomPreset.private_chat,
|
||||
)
|
||||
|
||||
return super().save(*args, **kwargs)
|
||||
|
||||
def get_absolute_url(self):
|
||||
|
Reference in New Issue
Block a user