mirror of https://github.com/zulip/zulip.git
sync_ldap_user_data: Pass realm as arg to select_related.
This commit updates the select_related calls in queries to get UserProfile objects in sync_ldap_user_data code to pass "realm" as argument to select_related call. Also, note that "realm" is the only non-null foreign key field in UserProfile object, so select_related() was only fetching realm object previously as well. But we should still pass "realm" as argument in select_related call so that we can make sure that only required fields are selected in case we add more foreign keys to UserProfile in future.
This commit is contained in:
parent
584026b21f
commit
63cc18a94b
|
@ -78,7 +78,7 @@ class Command(ZulipBaseCommand):
|
|||
realm = self.get_realm(options)
|
||||
user_profiles = self.get_users(options, realm, is_bot=False, include_deactivated=True)
|
||||
else:
|
||||
user_profile_query = UserProfile.objects.select_related().filter(is_bot=False)
|
||||
user_profile_query = UserProfile.objects.select_related("realm").filter(is_bot=False)
|
||||
|
||||
if not user_profile_query.exists():
|
||||
# This case provides a special error message if one
|
||||
|
|
Loading…
Reference in New Issue