Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
version: Display Zulip version in About Zulip dialog.
Anders Kaseorg668b5137b005
diff --git a/static/styles/night_mode.css b/static/styles/night_mode.cssindex 8e4522f9532..165957f1fa5 100644--- a/static/styles/night_mode.css+++ b/static/styles/night_mode.css@@ -335,12 +335,6 @@ on a dark background, and don't change the dark labels dark either. */opacity: 0.2;}- #about-zulip {- .about-zulip-version {- color: hsl(212, 17%, 81%);- }- }-#gear_menu_about_zulip {.white_zulip_icon_without_text {filter: invert(10%) sepia(16%) saturate(175%) hue-rotate(194deg)diff --git a/static/styles/zulip.css b/static/styles/zulip.cssindex 93409be964f..2a61462c297 100644--- a/static/styles/zulip.css+++ b/static/styles/zulip.css@@ -2720,41 +2720,17 @@ select.inline_select_topic_edit {}.overlay-content {- position: relative;- width: 300px;+ width: 440px;border-radius: 4px;}- .modal-body {- display: flex;- flex-direction: column;- align-items: center;- }-.about-zulip-logo {- padding-top: 20px;- height: 70px;- }-- .about-zulip-title {- font-weight: 600;- padding: 10px;+ text-align: center;+ margin: 30px;}- .about-zulip-version {- color: hsl(222, 8%, 28%);-- .fa-copy {- padding-left: 3px;- }-- :hover {- cursor: pointer;-- .fa-copy {- color: hsl(0, 0%, 0%);- }- }+ .about-zulip-logo img {+ height: 40px;}}diff --git a/templates/zerver/app/about-zulip.html b/templates/zerver/app/about-zulip.htmlindex af94ba37136..dce83b30582 100644--- a/templates/zerver/app/about-zulip.html+++ b/templates/zerver/app/about-zulip.html@@ -1,16 +1,30 @@-<div id="about-zulip" class="overlay flex new-style" tabindex="-1" role="dialog" data-overlay="about-zulip"- aria-labelledby="about-zulip-label" aria-hidden="true">+<div id="about-zulip" class="overlay flex new-style" tabindex="-1" role="dialog" data-overlay="about-zulip" aria-hidden="true"><div class="overlay-content modal-bg"><button type="button" class="exit" aria-label="{{ _('Close') }}"><span aria-hidden="true">×</span></button><div class="modal-body">- <img class="about-zulip-logo" src="/static/images/logo/zulip-icon-128x128.png" alt="" />- <div class="about-zulip-title">Zulip</div>- <p class="about-zulip-version">- {{zulip_version_name}}+ <div class="about-zulip-logo">+ <img src="/static/images/logo/zulip-org-logo.svg" alt="" />+ </div>+ <p>+ This is an installation of <a target="_blank" rel="noopener noreferrer"+ href="https://zulip.com">Zulip</a>.+ </p>+ <p>+ Zulip Server version {{zulip_version}}<i class="fa fa-copy tippy-zulip-tooltip" data-tippy-content="Copy version" data-tippy-placement="right" data-clipboard-text="{{zulip_version}}"></i>+ {% if zulip_merge_base and zulip_version != zulip_merge_base %}+ <br />+ Forked from upstream at {{zulip_merge_base}}+ <i class="fa fa-copy tippy-zulip-tooltip" data-tippy-content="Copy version" data-tippy-placement="right" data-clipboard-text="{{zulip_merge_base}}"></i>+ {% endif %}</p><p>- Zulip is <a target="_blank" rel="noopener noreferrer" href="https://github.com/zulip/zulip">open-source software</a>.</p>+ Copyright 2012–2015 Dropbox, Inc., 2015–2021 Kandra Labs, Inc., and contributors.+ </p>+ <p>+ Zulip is <a target="_blank" rel="noopener noreferrer" href="https://github.com/zulip/zulip#readme">open-source software</a>,+ distributed under the Apache 2.0 license.+ </p></div></div></div>diff --git a/tools/cache-zulip-git-version b/tools/cache-zulip-git-versionindex 330a6cd8549..e125e1187c4 100755--- a/tools/cache-zulip-git-version+++ b/tools/cache-zulip-git-version@@ -1,5 +1,13 @@#!/usr/bin/env bash-set -e+set -eucd "$(dirname "$0")/.."-git describe --tags --match='[0-9]*' >zulip-git-version || true+remote="$(git config zulip.zulipRemote)" || remote=upstream+{+ git describe --always --tags --match='[0-9]*'+ branches="$(git for-each-ref --format='%(objectname)' "refs/remotes/$remote/master" "refs/remotes/$remote/*.x")"+ mapfile -t branches <<<"$branches"+ if merge_base="$(git merge-base -- HEAD "${branches[@]}")"; then+ git describe --always --tags --match='[0-9]*' -- "$merge_base"+ fi+} >zulip-git-versiondiff --git a/version.py b/version.pyindex 14a45d00f71..5e847e9e54c 100644--- a/version.py+++ b/version.py@@ -1,15 +1,17 @@import osZULIP_VERSION = "4.0-rc1+git"+# Add information on number of commits and commit hash to version, if availablezulip_git_version_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), "zulip-git-version")+lines = [ZULIP_VERSION, ""]if os.path.exists(zulip_git_version_file):with open(zulip_git_version_file) as f:- version = f.read().strip()- if version:- ZULIP_VERSION = version+ lines = f.readlines() + ["", ""]+ZULIP_VERSION = lines.pop(0).strip()+ZULIP_MERGE_BASE = lines.pop(0).strip()LATEST_MAJOR_VERSION = "3.0"LATEST_RELEASE_VERSION = "3.0"diff --git a/zerver/context_processors.py b/zerver/context_processors.pyindex 25233769933..024240d6fdc 100644--- a/zerver/context_processors.py+++ b/zerver/context_processors.py@@ -49,13 +49,6 @@ def common_context(user: UserProfile) -> Dict[str, Any]:}-def get_zulip_version_name(zulip_version: str) -> str:- if zulip_version.endswith("+git"):- return "Zulip " + zulip_version[:-4]-- return "Zulip " + zulip_version--def get_realm_from_request(request: HttpRequest) -> Optional[Realm]:if hasattr(request, "user") and hasattr(request.user, "realm"):return request.user.realm@@ -142,8 +135,6 @@ def zulip_default_context(request: HttpRequest) -> Dict[str, Any]:"request_language": get_language(),}- ZULIP_VERSION_NAME = get_zulip_version_name(ZULIP_VERSION)-context = {"root_domain_landing_page": settings.ROOT_DOMAIN_LANDING_PAGE,"custom_logo_url": settings.CUSTOM_LOGO_URL,@@ -169,7 +160,6 @@ def zulip_default_context(request: HttpRequest) -> Dict[str, Any]:"password_min_length": settings.PASSWORD_MIN_LENGTH,"password_min_guesses": settings.PASSWORD_MIN_GUESSES,"zulip_version": ZULIP_VERSION,- "zulip_version_name": ZULIP_VERSION_NAME,"user_is_authenticated": user_is_authenticated,"settings_path": settings_path,"secrets_path": secrets_path,diff --git a/zerver/tests/test_context_processors.py b/zerver/tests/test_context_processors.pydeleted file mode 100644index 9026bd8cb4c..00000000000--- a/zerver/tests/test_context_processors.py+++ /dev/null@@ -1,8 +0,0 @@-from zerver.context_processors import get_zulip_version_name-from zerver.lib.test_classes import ZulipTestCase---class TestContextProcessors(ZulipTestCase):- def test_get_zulip_version_name(self) -> None:- self.assertEqual(get_zulip_version_name("4.0-dev+git"), "Zulip 4.0-dev")- self.assertEqual(get_zulip_version_name("4.0"), "Zulip 4.0")diff --git a/zerver/views/home.py b/zerver/views/home.pyindex e049bc20402..eb196920923 100644--- a/zerver/views/home.py+++ b/zerver/views/home.py@@ -8,6 +8,7 @@ from django.shortcuts import redirect, renderfrom django.urls import reversefrom django.utils.cache import patch_cache_control+from version import ZULIP_MERGE_BASE, ZULIP_VERSIONfrom zerver.context_processors import get_valid_realm_from_requestfrom zerver.decorator import web_public_view, zulip_login_requiredfrom zerver.forms import ToSForm@@ -240,6 +241,8 @@ def home_real(request: HttpRequest) -> HttpResponse:"is_admin": user_permission_info.is_realm_admin,"is_guest": user_permission_info.is_guest,"color_scheme": user_permission_info.color_scheme,+ "zulip_version": ZULIP_VERSION,+ "zulip_merge_base": ZULIP_MERGE_BASE,"navbar_logo_url": navbar_logo_url,"show_webathena": user_permission_info.show_webathena,"embedded": narrow_stream is not None,