users: Remove redundant compute_show_invites function.

This commits removes the redundant `compute_show_invites` function
which computes the `show_invites` page parameter in `lib/users.py`.

It is so because, commit 13399833b0 removed
the `show_invites` context variable passed in index.html.
Hence, the `show_invites` page_param key is no
longer required to compute in backend as it can be switched with
`settings_data.user_can_invite_others_to_realm()` in the frontend.

This commits also removes the `test_compute*` tests in
`test_home` that concerned with the `show_invites` page parameter
as they are no longer required.
This commit is contained in:
aryanshridhar
2021-07-08 21:07:18 +05:30
committed by Tim Abbott
parent 8b692943e7
commit 9049fb3bd4
5 changed files with 6 additions and 47 deletions

View File

@@ -16,7 +16,6 @@ from zerver.lib.i18n import (
get_language_list,
get_language_translation_data,
)
from zerver.lib.users import compute_show_invites
from zerver.models import Message, Realm, Stream, UserProfile
from zerver.views.message_flags import get_latest_update_message_flag_activity
@@ -179,7 +178,6 @@ def build_page_params_for_home_page_load(
two_fa_enabled = settings.TWO_FACTOR_AUTHENTICATION_ENABLED and user_profile is not None
billing_info = get_billing_info(user_profile)
show_invites = compute_show_invites(user_profile)
user_permission_info = get_user_permission_info(user_profile)
# Pass parameters to the client-side JavaScript code.
@@ -205,7 +203,6 @@ def build_page_params_for_home_page_load(
show_billing=billing_info.show_billing,
promote_sponsoring_zulip=promote_sponsoring_zulip_in_realm(realm),
show_plans=billing_info.show_plans,
show_invites=show_invites,
show_webathena=user_permission_info.show_webathena,
# Adding two_fa_enabled as condition saves us 3 queries when
# 2FA is not enabled.