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.

api: Expose server_needs_upgrade in register response.

Gaurav Pandey18ef0c3bc133
diff --git a/zerver/lib/events.py b/zerver/lib/events.py
index 60867d46a6e..159581d51de 100644
--- a/zerver/lib/events.py
+++ b/zerver/lib/events.py
@@ -22,6 +22,7 @@ from zerver.lib.actions import (
from zerver.lib.alert_words import user_alert_words
from zerver.lib.avatar import avatar_url
from zerver.lib.bot_config import load_bot_config_template
+from zerver.lib.compatibility import is_outdated_server
from zerver.lib.external_accounts import DEFAULT_EXTERNAL_ACCOUNTS
from zerver.lib.hotspots import get_next_hotspots
from zerver.lib.integrations import EMBEDDED_BOTS, WEBHOOK_INTEGRATIONS
@@ -275,6 +276,8 @@ def fetch_initial_state_data(
state["server_name_changes_disabled"] = settings.NAME_CHANGES_DISABLED
state["giphy_rating_options"] = realm.GIPHY_RATING_OPTIONS
+ state["server_needs_upgrade"] = is_outdated_server(user_profile)
+
# TODO: Should these have the realm prefix replaced with server_?
state["realm_push_notifications_enabled"] = push_notifications_enabled()
state["realm_default_external_accounts"] = DEFAULT_EXTERNAL_ACCOUNTS
diff --git a/zerver/lib/home.py b/zerver/lib/home.py
index b49da05cd84..3fe78dca1cc 100644
--- a/zerver/lib/home.py
+++ b/zerver/lib/home.py
@@ -8,7 +8,6 @@ from django.http import HttpRequest
from django.utils import translation
from two_factor.utils import default_device
-from zerver.lib.compatibility import is_outdated_server
from zerver.lib.events import do_events_register
from zerver.lib.i18n import (
get_and_set_request_language,
@@ -186,7 +185,6 @@ def build_page_params_for_home_page_load(
test_suite=settings.TEST_SUITE,
poll_timeout=settings.POLL_TIMEOUT,
insecure_desktop_app=insecure_desktop_app,
- server_needs_upgrade=is_outdated_server(user_profile),
login_page=settings.HOME_NOT_LOGGED_IN,
save_stacktraces=settings.SAVE_FRONTEND_STACKTRACES,
warn_no_email=settings.WARN_NO_EMAIL,
diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yaml
index 115f57385bd..4ae7e43f1e9 100644
--- a/zerver/openapi/zulip.yaml
+++ b/zerver/openapi/zulip.yaml
@@ -8976,6 +8976,16 @@ paths:
Whether the server allows name changes. Similar to
`realm_name_changes_disabled` but based on the `NAME_CHANGES_DISABLED`
Zulip server level setting.
+ server_needs_upgrade:
+ type: boolean
+ description: |
+ Present if `realm` is present in `fetch_event_types`.
+
+ Whether the server is running an old version based on the Zulip
+ [server release lifecycle](https://zulip.readthedocs.io/en/latest/overview/release-lifecycle.html#upgrade-nag),
+ such that the web app will display to the current user a prominent warning.
+
+ **Changes**: New in Zulip 5.0 (feature level 74).
realm_notifications_stream_id:
type: integer
description: |