change-email: Delete email caches on email change.

This commit is contained in:
Umair Khan 2017-01-23 14:38:52 +05:00 committed by Tim Abbott
parent f4b242e707
commit 41aa07adb6
1 changed files with 2 additions and 2 deletions

View File

@ -356,14 +356,14 @@ def flush_user_profile(sender, **kwargs):
# Invalidate our active_users_in_realm info dict if any user has changed
# the fields in the dict or become (in)active
if kwargs.get('update_fields') is None or \
len(set(active_user_dict_fields + ['is_active']) &
len(set(active_user_dict_fields + ['is_active', 'email']) &
set(kwargs['update_fields'])) > 0:
cache_delete(active_user_dicts_in_realm_cache_key(user_profile.realm))
# Invalidate our active_bots_in_realm info dict if any bot has
# changed the fields in the dict or become (in)active
if user_profile.is_bot and (kwargs['update_fields'] is None or
(set(active_bot_dict_fields + ['is_active']) &
(set(active_bot_dict_fields + ['is_active', 'email']) &
set(kwargs['update_fields']))):
cache_delete(active_bot_dicts_in_realm_cache_key(user_profile.realm))