Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

page_params: Remove unused first_in_realm.

Anders Kaseorge79572d0d5a3
diff --git a/zerver/lib/home.py b/zerver/lib/home.py
index 824540cede7..0c98501f564 100644
--- a/zerver/lib/home.py
+++ b/zerver/lib/home.py
@@ -138,7 +138,6 @@ def build_page_params_for_home_page_load(
narrow: List[NarrowTerm],
narrow_stream: Optional[Stream],
narrow_topic_name: Optional[str],
- first_in_realm: bool,
needs_tutorial: bool,
) -> Tuple[int, Dict[str, object]]:
"""
@@ -207,7 +206,6 @@ def build_page_params_for_home_page_load(
## Misc. extra data.
language_list=get_language_list(),
needs_tutorial=needs_tutorial,
- first_in_realm=first_in_realm,
furthest_read_time=furthest_read_time,
bot_types=get_bot_types(user_profile),
two_fa_enabled=two_fa_enabled,
diff --git a/zerver/tests/test_home.py b/zerver/tests/test_home.py
index 567fbd9e04f..8f50253bb3a 100644
--- a/zerver/tests/test_home.py
+++ b/zerver/tests/test_home.py
@@ -60,7 +60,6 @@ class HomeTest(ZulipTestCase):
"drafts",
"email",
"event_queue_longpoll_timeout_seconds",
- "first_in_realm",
"full_name",
"furthest_read_time",
"giphy_api_key",
@@ -250,7 +249,7 @@ class HomeTest(ZulipTestCase):
self.client_post("/json/bots", bot_info)
# Verify succeeds once logged-in
- with self.assert_database_query_count(50):
+ with self.assert_database_query_count(49):
with patch("zerver.lib.cache.cache_set") as cache_mock:
result = self._get_home_page(stream="Denmark")
self.check_rendered_logged_in_app(result)
@@ -340,7 +339,6 @@ class HomeTest(ZulipTestCase):
"bot_types",
"corporate_enabled",
"development_environment",
- "first_in_realm",
"furthest_read_time",
"insecure_desktop_app",
"is_spectator",
@@ -436,7 +434,7 @@ class HomeTest(ZulipTestCase):
def test_num_queries_for_realm_admin(self) -> None:
# Verify number of queries for Realm admin isn't much higher than for normal users.
self.login("iago")
- with self.assert_database_query_count(51):
+ with self.assert_database_query_count(50):
with patch("zerver.lib.cache.cache_set") as cache_mock:
result = self._get_home_page()
self.check_rendered_logged_in_app(result)
@@ -467,7 +465,7 @@ class HomeTest(ZulipTestCase):
self._get_home_page()
# Then for the second page load, measure the number of queries.
- with self.assert_database_query_count(45):
+ with self.assert_database_query_count(44):
result = self._get_home_page()
# Do a sanity check that our new streams were in the payload.
diff --git a/zerver/views/home.py b/zerver/views/home.py
index 50144716ab3..f932c811940 100644
--- a/zerver/views/home.py
+++ b/zerver/views/home.py
@@ -18,7 +18,6 @@ from zerver.lib.narrow_helpers import NarrowTerm
from zerver.lib.request import RequestNotes
from zerver.lib.streams import access_stream_by_name
from zerver.lib.subdomains import get_subdomain
-from zerver.lib.user_counts import realm_user_count
from zerver.models import Realm, RealmUserDefault, Stream, UserProfile
@@ -215,11 +214,9 @@ def home_real(request: HttpRequest) -> HttpResponse:
narrow, narrow_stream, narrow_topic_name = detect_narrowed_window(request, user_profile)
if user_profile is not None:
- first_in_realm = realm_user_count(user_profile.realm) == 1
needs_tutorial = user_profile.tutorial_status == UserProfile.TUTORIAL_WAITING
else:
- first_in_realm = False
# The current tutorial doesn't super make sense for logged-out users.
needs_tutorial = False
@@ -231,7 +228,6 @@ def home_real(request: HttpRequest) -> HttpResponse:
narrow=narrow,
narrow_stream=narrow_stream,
narrow_topic_name=narrow_topic_name,
- first_in_realm=first_in_realm,
needs_tutorial=needs_tutorial,
)