diff --git a/src/synapse_registration/registration/signals.py b/src/synapse_registration/registration/signals.py index c90ffe3..35ef56f 100644 --- a/src/synapse_registration/registration/signals.py +++ b/src/synapse_registration/registration/signals.py @@ -28,6 +28,13 @@ def handle_status_change(sender, instance, created, **kwargs): [settings.ADMIN_EMAIL], ) + for room in settings.AUTO_JOIN: + response = requests.post( + f"{settings.SYNAPSE_SERVER}/_synapse/admin/v1/join/{room}", + json={"user_id": f"@{instance.username}:{settings.MATRIX_DOMAIN}"}, + headers={"Authorization": f"Bearer {settings.SYNAPSE_ADMIN_TOKEN}"}, + ) + send_mail( "Registration Approved", f"Congratulations, {instance.username}! Your registration at {settings.MATRIX_DOMAIN} has been approved.", @@ -49,13 +56,6 @@ def handle_status_change(sender, instance, created, **kwargs): headers={"Authorization": f"Bearer {settings.SYNAPSE_ADMIN_TOKEN}"}, ) - for room in settings.AUTO_JOIN: - response = requests.post( - f"{settings.SYNAPSE_SERVER}/_synapse/admin/v1/join/{room}", - json={"user_id": f"@{instance.username}:{settings.MATRIX_DOMAIN}"}, - headers={"Authorization": f"Bearer {settings.SYNAPSE_ADMIN_TOKEN}"}, - ) - if response.status_code != 200: send_mail( "Deactivation Failed",