1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-08-16 22:10:05 +02:00

Drop Matrix support

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello
2024-01-13 16:46:19 +01:00
parent 2f4755ffc7
commit 93a2e2436d
12 changed files with 3 additions and 991 deletions

View File

@@ -32,7 +32,6 @@ from odf.table import CoveredTableCell, Table, TableCell, TableColumn, TableRow
from odf.text import P
from registration.models import StudentRegistration, VolunteerRegistration
from tfjm.lists import get_sympa_client
from tfjm.matrix import Matrix
from tfjm.views import AdminMixin, VolunteerMixin
from .forms import AddJuryForm, JoinTeamForm, MotivationLetterForm, NoteForm, ParticipationForm, PassageForm, \
@@ -68,8 +67,7 @@ class CreateTeamView(LoginRequiredMixin, CreateView):
"""
When a team is about to be created, the user automatically
joins the team, a mailing list got created and the user is
automatically subscribed to this mailing list, and finally
a Matrix room is created and the user is invited in this room.
automatically subscribed to this mailing list.
"""
ret = super().form_valid(form)
# The user joins the team
@@ -82,9 +80,6 @@ class CreateTeamView(LoginRequiredMixin, CreateView):
get_sympa_client().subscribe(user.email, f"equipe-{form.instance.trigram.lower()}", False,
f"{user.first_name} {user.last_name}")
# Invite the user in the team Matrix room
Matrix.invite(f"#equipe-{form.instance.trigram.lower()}:tfjm.org",
f"@{user.registration.matrix_username}:tfjm.org")
return ret
@@ -112,7 +107,7 @@ class JoinTeamView(LoginRequiredMixin, FormView):
def form_valid(self, form):
"""
When a user joins a team, the user is automatically subscribed to
the team mailing list,the user is invited in the team Matrix room.
the team mailing list.
"""
self.object = form.instance
ret = super().form_valid(form)
@@ -127,9 +122,6 @@ class JoinTeamView(LoginRequiredMixin, FormView):
get_sympa_client().subscribe(user.email, f"equipe-{form.instance.trigram.lower()}", False,
f"{user.first_name} {user.last_name}")
# Invite the user in the team Matrix room
Matrix.invite(f"#equipe-{form.instance.trigram.lower()}:tfjm.org",
f"@{user.registration.matrix_username}:tfjm.org")
return ret
def get_success_url(self):
@@ -468,9 +460,6 @@ class TeamLeaveView(LoginRequiredMixin, TemplateView):
request.user.registration.team = None
request.user.registration.save()
get_sympa_client().unsubscribe(request.user.email, f"equipe-{team.trigram.lower()}", False)
Matrix.kick(f"#equipe-{team.trigram.lower()}:tfjm.org",
f"@{request.user.registration.matrix_username}:tfjm.org",
"Équipe quittée")
if team.students.count() + team.coaches.count() == 0:
team.delete()
return redirect(reverse_lazy("index"))