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.

login_to_access: Change message displayed for empty narrows.

Aman Agrawal43d789993f04
diff --git a/frontend_tests/node_tests/narrow.js b/frontend_tests/node_tests/narrow.js
index 1e93ebe89af..baed2d0bbd7 100644
--- a/frontend_tests/node_tests/narrow.js
+++ b/frontend_tests/node_tests/narrow.js
@@ -2,7 +2,7 @@
const {strict: assert} = require("assert");
-const {with_function_call_disallowed_rewire, zrequire} = require("../zjsunit/namespace");
+const {with_function_call_disallowed_rewire, zrequire, mock_esm} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const $ = require("../zjsunit/zjquery");
const {page_params} = require("../zjsunit/zpage_params");
@@ -16,6 +16,10 @@ const stream_data = zrequire("stream_data");
const {Filter} = zrequire("../js/filter");
const narrow = zrequire("narrow");
+mock_esm("../../static/js/spectators", {
+ login_to_access: () => {},
+});
+
function empty_narrow_html(title, html, search_data) {
const opts = {
title,
diff --git a/static/js/narrow_banner.js b/static/js/narrow_banner.js
index 214971a4e40..c124859a636 100644
--- a/static/js/narrow_banner.js
+++ b/static/js/narrow_banner.js
@@ -5,6 +5,7 @@ import {narrow_error} from "./narrow_error";
import * as narrow_state from "./narrow_state";
import {page_params} from "./page_params";
import * as people from "./people";
+import * as spectators from "./spectators";
import * as stream_data from "./stream_data";
const SPECTATOR_STREAM_NARROW_BANNER = {
@@ -204,6 +205,7 @@ function pick_empty_narrow_banner() {
// in which you were never subscribed.
if (page_params.is_spectator) {
+ spectators.login_to_access(true);
return SPECTATOR_STREAM_NARROW_BANNER;
}
diff --git a/static/js/spectators.js b/static/js/spectators.js
index cff8f03f51b..270ce6f5364 100644
--- a/static/js/spectators.js
+++ b/static/js/spectators.js
@@ -12,16 +12,20 @@ import render_login_to_access_modal from "../templates/login_to_access.hbs";
import * as browser_history from "./browser_history";
import * as hash_util from "./hash_util";
import * as overlays from "./overlays";
+import {page_params} from "./page_params";
-export function login_to_access() {
+export function login_to_access(empty_narrow) {
// Hide all overlays, popover and go back to the previous hash if the
// hash has changed.
const login_link = hash_util.build_login_link();
+ const realm_name = page_params.realm_name;
$("body").append(
render_login_to_access_modal({
signup_link: "/register",
login_link,
+ empty_narrow,
+ realm_name,
}),
);
diff --git a/static/templates/login_to_access.hbs b/static/templates/login_to_access.hbs
index 9a2a6129554..443fb83cb0e 100644
--- a/static/templates/login_to_access.hbs
+++ b/static/templates/login_to_access.hbs
@@ -3,18 +3,27 @@
<div class="modal__container" role="dialog" aria-modal="true" aria-labelledby="login_to_access_modal_label">
<header class="modal__header">
<h1 class="modal__title" id="login_to_access_modal_label">
- {{t "Login required" }}
+ {{#tr}}
+ Join the {realm_name} community
+ {{/tr}}
</h1>
<button class="modal__close" aria-label="{{t 'Close modal' }}" data-micromodal-close></button>
</header>
<main class="modal__content">
+ {{#if empty_narrow}}
<p>
{{#tr}}
- Since you are not logged in, you can only view messages in
- <z-link>publicly accessible conversations</z-link>.
+ This is not a <z-link>publicly accessible</z-link> conversation.
{{#*inline "z-link"}}<a target="_blank" rel="noopener noreferrer" href="/help/public-access-option">{{> @partial-block}}</a>{{/inline}}
{{/tr}}
</p>
+ {{/if}}
+ <p>
+ {{#tr}}
+ You can fully access this community and participate in conversations
+ by creating a Zulip account in this organization.
+ {{/tr}}
+ </p>
</main>
<footer class="modal__footer">
<a class="modal__btn dialog_submit_button" href="{{signup_link}}">