invitations: Don't notify now-deactivated users.

While accepting an invitation from a user, there was no condition in
place to check if the user sending the invitation was now
now-deactivated.

Skip sending notifications about newly-joined users to users who are
now disabled.

Fixes #18569.
This commit is contained in:
parth
2021-11-09 21:20:55 +05:30
committed by Alex Vandiver
parent 1e4593b2ae
commit 4edf029ad5
2 changed files with 31 additions and 1 deletions

View File

@@ -503,7 +503,12 @@ def process_new_human_user(
add_new_user_history(user_profile, streams)
# mit_beta_users don't have a referred_by field
if not mit_beta_user and prereg_user is not None and prereg_user.referred_by is not None:
if (
not mit_beta_user
and prereg_user is not None
and prereg_user.referred_by is not None
and prereg_user.referred_by.is_active
):
# This is a cross-realm private message.
with override_language(prereg_user.referred_by.default_language):
internal_send_private_message(