mirror of
https://github.com/zulip/zulip.git
synced 2025-11-08 16:01:58 +00:00
Use get_user_profile_by_email more consistently.
The previous situation was bad for two reasons: (1) It had a lot of copies of the code, some of them missing pieces: UserProfile.objects.get(user__email__iexact=foo) This was in particular going to be inconvenient since we are dropping the __user part of that. (2) It didn't take advantage of our memcached caching. (imported from commit 2325795f288a7cf306cdae191f5d3080aac0651a)
This commit is contained in:
@@ -115,7 +115,7 @@ def compute_mit_user_fullname(email):
|
||||
@transaction.commit_on_success
|
||||
def create_mit_user_if_needed(realm, email):
|
||||
try:
|
||||
return UserProfile.objects.get(user__email__iexact=email)
|
||||
return get_user_profile_by_email(email)
|
||||
except UserProfile.DoesNotExist:
|
||||
try:
|
||||
# Forge a user for this person
|
||||
@@ -126,7 +126,7 @@ def create_mit_user_if_needed(realm, email):
|
||||
# Unless we raced with another thread doing the same
|
||||
# thing, in which case we should get the user they made
|
||||
transaction.commit()
|
||||
return UserProfile.objects.get(user__email__iexact=email)
|
||||
return get_user_profile_by_email(email)
|
||||
|
||||
def log_message(message):
|
||||
if not message.sending_client.name.startswith("test:"):
|
||||
|
||||
Reference in New Issue
Block a user