fix: Reorders auto-join logic post-registration
Moves auto-join functionality for newly registered users to occur after sending the registration approval email. Ensures user feedback through email is handled before attempting room joins, potentially improving user experience.
This commit is contained in:
parent
a43914de62
commit
5bb74d5389
1 changed files with 7 additions and 7 deletions
|
@ -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",
|
||||
|
|
Loading…
Reference in a new issue