realms: Do not prefetch settings in get_realm.

There is no need to prefetch group settings using select_related
in get_realm as we only need to save queries when computing the
setting values in fetch_initial_state_data and we already refetch
the realm using get_realm_with_settings for that.
This commit is contained in:
Sahil Batra
2024-06-18 16:51:37 +05:30
committed by Tim Abbott
parent 19373d61e8
commit 048221212e

View File

@@ -1064,10 +1064,7 @@ post_delete.connect(realm_pre_and_post_delete_handler, sender=Realm)
def get_realm(string_id: str) -> Realm:
return Realm.objects.select_related(
"can_create_public_channel_group",
"can_create_public_channel_group__named_user_group",
).get(string_id=string_id)
return Realm.objects.get(string_id=string_id)
def get_realm_by_id(realm_id: int) -> Realm: