Repository: zulip/zulip

Issue:
No way to discover Zulip version number from within UI.
As I was adding a comment to issue #6977 just now, I wanted to include the version number of the Zulip instance we're running.  But I couldn't find that information anywhere in the UI.  Traditionally, the version number is either in the page footer or in an "About" page somewhere.  But it's not in the footers and I couldn't find an About page, nor any other page that has the instance's version number.  I poked around in the documentation pages and settings pages, but couldn't find it anywhere in there either.

I ended up shelling into the server and looking at the `deployments/2017-10-12-17-22-56/version` file.

  


Discussion:
@kfogel you can check the version number using the api endpoint - `yourserver/api/v1/server_settings`
Example - https://chat.zulip.org/api/v1/server_settings
@zulipbot claim
It's at https://chat.zulip.org/history/, which is parked there until we turn it into a proper /about page and link to it from the footer. @skunkmb, I suspect the solution here is just to finish that project, since that's where people will expect it. 
Hello @skunkmb, you have been unassigned from this issue because you have not updated this issue or any referenced pull requests for over 14 days.

You can reclaim this issue or claim any other issue by commenting `@zulipbot claim` on that issue.

Thanks for your contributions, and hope to see you again soon!
We [discussed this just now](https://chat.zulip.org/#narrow/stream/general/subject/zulipchat.2Ecom/near/494918) in Zulip developer chat.

> places like https://chat.zulip.org/history/ and https://chat.zulip.org/api/v1/server_settings say "1.7.1+git" which is not as precise as I'd like.

@timabbott said, specifically about exposing the current commit ID for zulipchat.com organizations,

> It's somewhat useless to do a commit ID (because there's usually a few operational-related or debugging or revert or whatever commits on zulipchat.com that aren't in the main repo), but we could do a count of commits pretty easily. Probably the ideal thing would be to have the merge-base of `upstream/master` with the current commit, but that gets a bit annoying to construct (but still probably doable).
@zulipbot claim
Hello @rightauth!

Thanks for your interest in Zulip! You have attempted to claim an issue without the labels "help wanted", "good first issue". Since you're a new contributor, you can only claim and submit pull requests for issues with the [help wanted](https://github.com/zulip/zulip/issues?q=is%3Aopen+is%3Aissue+no%3Aassignee+label%3A%22help+wanted%22) or [good first issue](https://github.com/zulip/zulip/issues?q=is%3Aopen+is%3Aissue+no%3Aassignee+label%3A%22good+first+issue%22) labels.

If this is your first time here, we recommend reading our [guide for new contributors](https://zulip.readthedocs.io/en/latest/overview/contributing.html) before getting started.
@zulipbot claim

Resolving patch:
diff --git a/zerver/context_processors.py b/zerver/context_processors.py
--- a/zerver/context_processors.py
+++ b/zerver/context_processors.py
@@ -49,6 +49,13 @@ 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
@@ -135,6 +142,8 @@ 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,
@@ -160,6 +169,7 @@ 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,


Test patch:
diff --git a/zerver/tests/test_context_processors.py b/zerver/tests/test_context_processors.py
new file mode 100644
--- /dev/null
+++ b/zerver/tests/test_context_processors.py
@@ -0,0 +1,8 @@
+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")