mirror of https://github.com/zulip/zulip.git
parent
966e63cc14
commit
4df8c6610f
|
@ -0,0 +1,67 @@
|
|||
"use strict";
|
||||
|
||||
const {strict: assert} = require("assert");
|
||||
|
||||
const {zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const {page_params} = require("../zjsunit/zpage_params");
|
||||
|
||||
const gear_menu = zrequire("gear_menu");
|
||||
|
||||
run_test("version_display_string", () => {
|
||||
let expected_version_display_string;
|
||||
|
||||
// An official release
|
||||
page_params.zulip_version = "5.6";
|
||||
page_params.zulip_merge_base = "5.6";
|
||||
expected_version_display_string = "translated: Zulip Server 5.6";
|
||||
assert.equal(gear_menu.version_display_string(), expected_version_display_string);
|
||||
|
||||
// An official beta
|
||||
page_params.zulip_version = "6.0-beta1";
|
||||
page_params.zulip_merge_base = "6.0-beta1";
|
||||
expected_version_display_string = "translated: Zulip Server 6.0-beta1";
|
||||
assert.equal(gear_menu.version_display_string(), expected_version_display_string);
|
||||
|
||||
// An official release candidate
|
||||
page_params.zulip_version = "6.0-rc1";
|
||||
page_params.zulip_merge_base = "6.0-rc1";
|
||||
expected_version_display_string = "translated: Zulip Server 6.0-rc1";
|
||||
assert.equal(gear_menu.version_display_string(), expected_version_display_string);
|
||||
|
||||
// The Zulip development environment
|
||||
page_params.zulip_version = "6.0-dev+git";
|
||||
page_params.zulip_merge_base = "6.0-dev+git";
|
||||
expected_version_display_string = "translated: Zulip Server dev environment";
|
||||
assert.equal(gear_menu.version_display_string(), expected_version_display_string);
|
||||
|
||||
// A commit on Zulip's main branch.
|
||||
page_params.zulip_version = "6.0-dev-1976-g4bb381fc80";
|
||||
page_params.zulip_merge_base = "6.0-dev-1976-g4bb381fc80";
|
||||
expected_version_display_string = "translated: Zulip Server 6.0-dev";
|
||||
assert.equal(gear_menu.version_display_string(), expected_version_display_string);
|
||||
|
||||
// A fork with 18 commits beyond Zulip's main branch.
|
||||
page_params.zulip_version = "6.0-dev-1994-g93730766b0";
|
||||
page_params.zulip_merge_base = "6.0-dev-1976-g4bb381fc80";
|
||||
expected_version_display_string = "translated: Zulip Server 6.0-dev (modified)";
|
||||
assert.equal(gear_menu.version_display_string(), expected_version_display_string);
|
||||
|
||||
// A commit from the Zulip 5.x branch
|
||||
page_params.zulip_version = "5.6+git-4-g385a408be5";
|
||||
page_params.zulip_merge_base = "5.6+git-4-g385a408be5";
|
||||
expected_version_display_string = "translated: Zulip Server 5.6 (patched)";
|
||||
assert.equal(gear_menu.version_display_string(), expected_version_display_string);
|
||||
|
||||
// A fork with 3 commits beyond the Zulip 5.x branch.
|
||||
page_params.zulip_version = "5.6+git-4-g385a408be5";
|
||||
page_params.zulip_merge_base = "5.6+git-7-abcda4235c2";
|
||||
expected_version_display_string = "translated: Zulip Server 5.6 (modified)";
|
||||
assert.equal(gear_menu.version_display_string(), expected_version_display_string);
|
||||
|
||||
// A fork of a Zulip release commit, not on 5.x branch.
|
||||
page_params.zulip_version = "5.3-1-g7ed896c0db";
|
||||
page_params.zulip_merge_base = "5.3";
|
||||
expected_version_display_string = "translated: Zulip Server 5.3 (modified)";
|
||||
assert.equal(gear_menu.version_display_string(), expected_version_display_string);
|
||||
});
|
|
@ -98,8 +98,52 @@ export function update_org_settings_menu_item() {
|
|||
}
|
||||
}
|
||||
|
||||
export function version_display_string() {
|
||||
const version = page_params.zulip_version;
|
||||
const is_fork = page_params.zulip_merge_base && page_params.zulip_merge_base !== version;
|
||||
|
||||
if (page_params.zulip_version.endsWith("-dev+git")) {
|
||||
// The development environment uses this version string format.
|
||||
return $t({defaultMessage: "Zulip Server dev environment"});
|
||||
}
|
||||
|
||||
if (is_fork) {
|
||||
// For forks, we want to describe the Zulip version this was
|
||||
// forked from, and that it was modified.
|
||||
const display_version = page_params.zulip_merge_base
|
||||
.replace(/\+git.*/, "")
|
||||
.replace(/-dev.*/, "-dev");
|
||||
return $t({defaultMessage: "Zulip Server {display_version} (modified)"}, {display_version});
|
||||
}
|
||||
|
||||
// The below cases are all for official versions; either a
|
||||
// release, or Git commit from one of Zulip's official branches.
|
||||
|
||||
if (version.includes("+git")) {
|
||||
// A version from a Zulip official maintenance branch such as 5.x.
|
||||
const display_version = version.replace(/\+git.*/, "");
|
||||
return $t({defaultMessage: "Zulip Server {display_version} (patched)"}, {display_version});
|
||||
}
|
||||
|
||||
const display_version = version.replace(/\+git.*/, "").replace(/-dev.*/, "-dev");
|
||||
return $t({defaultMessage: "Zulip Server {display_version}"}, {display_version});
|
||||
}
|
||||
|
||||
export function initialize() {
|
||||
const rendered_gear_menu = render_gear_menu({
|
||||
realm_name: page_params.realm_name,
|
||||
realm_uri: new URL(page_params.realm_uri).hostname,
|
||||
is_owner: page_params.is_owner,
|
||||
is_admin: page_params.is_admin,
|
||||
is_self_hosted: page_params.realm_plan_type === 1,
|
||||
is_plan_limited: page_params.realm_plan_type === 2,
|
||||
is_plan_standard: page_params.realm_plan_type === 3,
|
||||
is_plan_standard_sponsored_for_free: page_params.realm_plan_type === 4,
|
||||
is_business_org: page_params.realm_org_type === 10,
|
||||
is_education_org: page_params.realm_org_type === 30 || page_params.realm_org_type === 35,
|
||||
standard_plan_name: "Zulip Cloud Standard",
|
||||
server_needs_upgrade: page_params.server_needs_upgrade,
|
||||
version_display_string: version_display_string(),
|
||||
apps_page_url: page_params.apps_page_url,
|
||||
can_invite_others_to_realm: settings_data.user_can_invite_others_to_realm(),
|
||||
corporate_enabled: page_params.corporate_enabled,
|
||||
|
|
|
@ -504,6 +504,10 @@ body.dark-theme {
|
|||
.light-theme {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.dropdown-menu a:hover {
|
||||
color: hsl(0, 0%, 100%);
|
||||
}
|
||||
}
|
||||
|
||||
.nav .dropdown-menu::after,
|
||||
|
|
|
@ -361,6 +361,59 @@ p.n-margin {
|
|||
}
|
||||
}
|
||||
|
||||
#gear-menu .dropdown-menu {
|
||||
.org-name,
|
||||
.org-url {
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
.org-info {
|
||||
text-align: center;
|
||||
|
||||
a {
|
||||
white-space: normal;
|
||||
}
|
||||
}
|
||||
|
||||
.org-name {
|
||||
font-size: large;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.org-url {
|
||||
line-height: 100%;
|
||||
color: hsl(0, 0%, 52%);
|
||||
}
|
||||
|
||||
.org-version {
|
||||
padding-top: 3px;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.org-upgrade {
|
||||
color: hsl(226, 82%, 60%);
|
||||
|
||||
a {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.org-plan,
|
||||
.org-upgrade {
|
||||
a {
|
||||
line-height: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
.plan-separator {
|
||||
line-height: 8px;
|
||||
}
|
||||
|
||||
.small-font-size {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.app {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
|
|
@ -8,6 +8,45 @@
|
|||
view is a Bootstrap nav tab, even though we don't show the tab
|
||||
anymore --}}
|
||||
<li class="invisible" style="display:none;" role="presentation"><a href="#message_feed_container" data-toggle="tab"></a></li>
|
||||
<li class="org-info org-name">{{realm_name}}</li>
|
||||
<li class="org-info org-url">{{realm_uri}}</li>
|
||||
{{#if is_self_hosted }}
|
||||
<li class="org-info org-version">
|
||||
<a href="#about-zulip" role="menuitem">{{version_display_string}}</a>
|
||||
</li>
|
||||
{{#if server_needs_upgrade }}
|
||||
<li class="org-info org-upgrade small-font-size">
|
||||
<a href="https://zulip.readthedocs.io/en/stable/production/upgrade-or-modify.html" target="_blank" rel="noopener noreferrer" role="menuitem">{{t 'Upgrade to the latest release' }}</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
{{else}}
|
||||
<li class="org-info org-plan hidden-for-spectators small-font-size">
|
||||
{{#if is_plan_limited }}
|
||||
<a href="/plans" target="_blank" rel="noopener noreferrer" role="menuitem">Zulip Cloud Free</a>
|
||||
{{else if is_plan_standard}}
|
||||
<a href="/plans" target="_blank" rel="noopener noreferrer" role="menuitem">Zulip Cloud Standard</a>
|
||||
{{else if is_plan_standard_sponsored_for_free}}
|
||||
<a href="/plans" target="_blank" rel="noopener noreferrer" role="menuitem">Zulip Cloud Standard, sponsored for free</a>
|
||||
{{/if}}
|
||||
</li>
|
||||
{{/if}}
|
||||
{{#if (and is_plan_limited is_owner) }}
|
||||
<li class="org-info org-upgrade small-font-size">
|
||||
<a href="/upgrade" target="_blank" rel="noopener noreferrer" role="menuitem">{{#tr}}Upgrade to {standard_plan_name}{{/tr}}</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
{{#if is_plan_limited }}
|
||||
{{#if is_education_org }}
|
||||
<li class="org-info org-upgrade small-font-size">
|
||||
<a href="/upgrade" target="_blank" rel="noopener noreferrer" role="menuitem">{{t 'Request education pricing' }}</a>
|
||||
</li>
|
||||
{{else if (not is_business_org) }}
|
||||
<li class="org-info org-upgrade small-font-size">
|
||||
<a href="/upgrade" target="_blank" rel="noopener noreferrer" role="menuitem">{{t 'Request sponsorship' }}</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
<li class="divider" role="presentation"></li>
|
||||
<li class="hidden-for-spectators" role="presentation">
|
||||
<a href="#streams/subscribed" role="menuitem">
|
||||
<i class="fa fa-exchange" aria-hidden="true"></i> {{t 'Manage streams' }}
|
||||
|
|
|
@ -42,6 +42,7 @@ IGNORED_PHRASES = [
|
|||
r"Zephyr",
|
||||
r"Zoom",
|
||||
r"Zulip",
|
||||
r"Zulip Server",
|
||||
r"Zulip Account Security",
|
||||
r"Zulip Security",
|
||||
r"Zulip Cloud Standard",
|
||||
|
|
Loading…
Reference in New Issue