mirror of
https://gitlab.com/animath/si/plateforme-corres2math.git
synced 2024-12-05 02:06:52 +00:00
Fix auto-invitation in Matrix public rooms
This commit is contained in:
parent
c80355f2bc
commit
be17d11581
@ -15,3 +15,6 @@ class RegistrationConfig(AppConfig):
|
||||
pre_save.connect(send_email_link, "auth.User")
|
||||
post_save.connect(create_admin_registration, "auth.User")
|
||||
post_save.connect(invite_to_public_rooms, "registration.Registration")
|
||||
post_save.connect(invite_to_public_rooms, "registration.StudentRegistration")
|
||||
post_save.connect(invite_to_public_rooms, "registration.CoachRegistration")
|
||||
post_save.connect(invite_to_public_rooms, "registration.AdminRegistration")
|
||||
|
@ -41,11 +41,11 @@ def create_admin_registration(instance, **_):
|
||||
AdminRegistration.objects.get_or_create(user=instance)
|
||||
|
||||
|
||||
def invite_to_public_rooms(instance: Registration, **_):
|
||||
def invite_to_public_rooms(instance: Registration, created: bool, **_):
|
||||
"""
|
||||
When a user got registered, automatically invite the Matrix user into public rooms.
|
||||
"""
|
||||
if not instance.pk:
|
||||
if not created:
|
||||
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",
|
||||
|
Loading…
Reference in New Issue
Block a user