refactor: Extract narrow_banner module.

This is a mostly verbatim extraction.

I re-phrased one line of code to work around a lint
false alarm. (Look for `preamble` in the diff.)

There are about 8 lines missing coverage here, so
the new module might be a good candidate to get
100% line coverage on.

Before this change, you would need to remove 74
edges from our dependency graph to make it
acyclic. Now it's 72.
This commit is contained in:
Steve Howell
2021-03-26 14:21:47 +00:00
committed by Tim Abbott
parent e72f208fde
commit c67f82b073
8 changed files with 220 additions and 220 deletions

View File

@@ -14,6 +14,7 @@ const stream_topic_history = mock_esm("../../static/js/stream_topic_history");
const hash_util = zrequire("hash_util"); const hash_util = zrequire("hash_util");
const compose_state = zrequire("compose_state"); const compose_state = zrequire("compose_state");
const narrow_banner = zrequire("narrow_banner");
const narrow_state = zrequire("narrow_state"); const narrow_state = zrequire("narrow_state");
const people = zrequire("people"); const people = zrequire("people");
const stream_data = zrequire("stream_data"); const stream_data = zrequire("stream_data");
@@ -73,7 +74,7 @@ run_test("uris", () => {
run_test("show_empty_narrow_message", () => { run_test("show_empty_narrow_message", () => {
narrow_state.reset_current_filter(); narrow_state.reset_current_filter();
narrow.show_empty_narrow_message(); narrow_banner.show_empty_narrow_message();
assert.equal($(".empty_feed_notice").visible(), false); assert.equal($(".empty_feed_notice").visible(), false);
assert($("#empty_narrow_message").visible()); assert($("#empty_narrow_message").visible());
assert.equal( assert.equal(
@@ -83,55 +84,55 @@ run_test("show_empty_narrow_message", () => {
// for non-existent or private stream // for non-existent or private stream
set_filter([["stream", "Foo"]]); set_filter([["stream", "Foo"]]);
narrow.show_empty_narrow_message(); narrow_banner.show_empty_narrow_message();
assert($("#nonsubbed_private_nonexistent_stream_narrow_message").visible()); assert($("#nonsubbed_private_nonexistent_stream_narrow_message").visible());
// for non sub public stream // for non sub public stream
stream_data.add_sub({name: "ROME", stream_id: 99}); stream_data.add_sub({name: "ROME", stream_id: 99});
stream_data.update_calculated_fields(stream_data.get_sub("ROME")); stream_data.update_calculated_fields(stream_data.get_sub("ROME"));
set_filter([["stream", "Rome"]]); set_filter([["stream", "Rome"]]);
narrow.show_empty_narrow_message(); narrow_banner.show_empty_narrow_message();
assert($("#nonsubbed_stream_narrow_message").visible()); assert($("#nonsubbed_stream_narrow_message").visible());
set_filter([["is", "starred"]]); set_filter([["is", "starred"]]);
narrow.show_empty_narrow_message(); narrow_banner.show_empty_narrow_message();
assert($("#empty_star_narrow_message").visible()); assert($("#empty_star_narrow_message").visible());
set_filter([["is", "mentioned"]]); set_filter([["is", "mentioned"]]);
narrow.show_empty_narrow_message(); narrow_banner.show_empty_narrow_message();
assert($("#empty_narrow_all_mentioned").visible()); assert($("#empty_narrow_all_mentioned").visible());
set_filter([["is", "private"]]); set_filter([["is", "private"]]);
narrow.show_empty_narrow_message(); narrow_banner.show_empty_narrow_message();
assert($("#empty_narrow_all_private_message").visible()); assert($("#empty_narrow_all_private_message").visible());
set_filter([["is", "unread"]]); set_filter([["is", "unread"]]);
narrow.show_empty_narrow_message(); narrow_banner.show_empty_narrow_message();
assert($("#no_unread_narrow_message").visible()); assert($("#no_unread_narrow_message").visible());
set_filter([["pm-with", ["Yo"]]]); set_filter([["pm-with", ["Yo"]]]);
narrow.show_empty_narrow_message(); narrow_banner.show_empty_narrow_message();
assert($("#non_existing_user").visible()); assert($("#non_existing_user").visible());
people.add_active_user(alice); people.add_active_user(alice);
set_filter([["pm-with", ["alice@example.com", "Yo"]]]); set_filter([["pm-with", ["alice@example.com", "Yo"]]]);
narrow.show_empty_narrow_message(); narrow_banner.show_empty_narrow_message();
assert($("#non_existing_users").visible()); assert($("#non_existing_users").visible());
set_filter([["pm-with", "alice@example.com"]]); set_filter([["pm-with", "alice@example.com"]]);
narrow.show_empty_narrow_message(); narrow_banner.show_empty_narrow_message();
assert($("#empty_narrow_private_message").visible()); assert($("#empty_narrow_private_message").visible());
set_filter([["group-pm-with", "alice@example.com"]]); set_filter([["group-pm-with", "alice@example.com"]]);
narrow.show_empty_narrow_message(); narrow_banner.show_empty_narrow_message();
assert($("#empty_narrow_group_private_message").visible()); assert($("#empty_narrow_group_private_message").visible());
set_filter([["sender", "ray@example.com"]]); set_filter([["sender", "ray@example.com"]]);
narrow.show_empty_narrow_message(); narrow_banner.show_empty_narrow_message();
assert($("#silent_user").visible()); assert($("#silent_user").visible());
set_filter([["sender", "sinwar@example.com"]]); set_filter([["sender", "sinwar@example.com"]]);
narrow.show_empty_narrow_message(); narrow_banner.show_empty_narrow_message();
assert($("#non_existing_user").visible()); assert($("#non_existing_user").visible());
const display = $("#empty_search_stop_words_string"); const display = $("#empty_search_stop_words_string");
@@ -142,7 +143,7 @@ run_test("show_empty_narrow_message", () => {
}; };
set_filter([["search", "grail"]]); set_filter([["search", "grail"]]);
narrow.show_empty_narrow_message(); narrow_banner.show_empty_narrow_message();
assert($("#empty_search_narrow_message").visible()); assert($("#empty_search_narrow_message").visible());
assert.equal(items.length, 2); assert.equal(items.length, 2);
@@ -163,7 +164,7 @@ run_test("show_search_stopwords", () => {
}; };
set_filter([["search", "what about grail"]]); set_filter([["search", "what about grail"]]);
narrow.show_empty_narrow_message(); narrow_banner.show_empty_narrow_message();
assert($("#empty_search_narrow_message").visible()); assert($("#empty_search_narrow_message").visible());
assert.equal(items.length, 3); assert.equal(items.length, 3);
@@ -176,7 +177,7 @@ run_test("show_search_stopwords", () => {
["stream", "streamA"], ["stream", "streamA"],
["search", "what about grail"], ["search", "what about grail"],
]); ]);
narrow.show_empty_narrow_message(); narrow_banner.show_empty_narrow_message();
assert($("#empty_search_narrow_message").visible()); assert($("#empty_search_narrow_message").visible());
assert.equal(items.length, 4); assert.equal(items.length, 4);
@@ -191,7 +192,7 @@ run_test("show_search_stopwords", () => {
["topic", "topicA"], ["topic", "topicA"],
["search", "what about grail"], ["search", "what about grail"],
]); ]);
narrow.show_empty_narrow_message(); narrow_banner.show_empty_narrow_message();
assert($("#empty_search_narrow_message").visible()); assert($("#empty_search_narrow_message").visible());
assert.equal(items.length, 4); assert.equal(items.length, 4);
@@ -212,7 +213,7 @@ run_test("show_invalid_narrow_message", () => {
["stream", "streamA"], ["stream", "streamA"],
["stream", "streamB"], ["stream", "streamB"],
]); ]);
narrow.show_empty_narrow_message(); narrow_banner.show_empty_narrow_message();
assert($("#empty_search_narrow_message").visible()); assert($("#empty_search_narrow_message").visible());
assert.equal( assert.equal(
display.text(), display.text(),
@@ -223,7 +224,7 @@ run_test("show_invalid_narrow_message", () => {
["topic", "topicA"], ["topic", "topicA"],
["topic", "topicB"], ["topic", "topicB"],
]); ]);
narrow.show_empty_narrow_message(); narrow_banner.show_empty_narrow_message();
assert($("#empty_search_narrow_message").visible()); assert($("#empty_search_narrow_message").visible());
assert.equal( assert.equal(
display.text(), display.text(),
@@ -237,7 +238,7 @@ run_test("show_invalid_narrow_message", () => {
["sender", "alice@example.com"], ["sender", "alice@example.com"],
["sender", "ray@example.com"], ["sender", "ray@example.com"],
]); ]);
narrow.show_empty_narrow_message(); narrow_banner.show_empty_narrow_message();
assert($("#empty_search_narrow_message").visible()); assert($("#empty_search_narrow_message").visible());
assert.equal( assert.equal(
display.text(), display.text(),

View File

@@ -7,7 +7,7 @@ import * as message_list from "./message_list";
import * as message_scroll from "./message_scroll"; import * as message_scroll from "./message_scroll";
import * as message_store from "./message_store"; import * as message_store from "./message_store";
import * as message_util from "./message_util"; import * as message_util from "./message_util";
import * as narrow from "./narrow"; import * as narrow_banner from "./narrow_banner";
import {page_params} from "./page_params"; import {page_params} from "./page_params";
import * as people from "./people"; import * as people from "./people";
import * as pm_list from "./pm_list"; import * as pm_list from "./pm_list";
@@ -45,7 +45,7 @@ function process_result(data, opts) {
) { ) {
// Even after trying to load more messages, we have no // Even after trying to load more messages, we have no
// messages to display in this narrow. // messages to display in this narrow.
narrow.show_empty_narrow_message(); narrow_banner.show_empty_narrow_message();
} }
messages = messages.map((message) => { messages = messages.map((message) => {

View File

@@ -5,7 +5,7 @@ import * as blueslip from "./blueslip";
import {i18n} from "./i18n"; import {i18n} from "./i18n";
import {MessageListData} from "./message_list_data"; import {MessageListData} from "./message_list_data";
import {MessageListView} from "./message_list_view"; import {MessageListView} from "./message_list_view";
import * as narrow from "./narrow"; import * as narrow_banner from "./narrow_banner";
import * as narrow_state from "./narrow_state"; import * as narrow_state from "./narrow_state";
import {page_params} from "./page_params"; import {page_params} from "./page_params";
import * as stream_data from "./stream_data"; import * as stream_data from "./stream_data";
@@ -74,7 +74,7 @@ export class MessageList {
// If adding some new messages to the message tables caused // If adding some new messages to the message tables caused
// our current narrow to no longer be empty, hide the empty // our current narrow to no longer be empty, hide the empty
// feed placeholder text. // feed placeholder text.
narrow.hide_empty_narrow_message(); narrow_banner.hide_empty_narrow_message();
} }
if (this === narrowed && !this.empty() && this.selected_id() === -1) { if (this === narrowed && !this.empty() && this.selected_id() === -1) {
@@ -363,9 +363,9 @@ export class MessageList {
if (this === narrowed) { if (this === narrowed) {
if (this.empty()) { if (this.empty()) {
narrow.show_empty_narrow_message(); narrow_banner.show_empty_narrow_message();
} else { } else {
narrow.hide_empty_narrow_message(); narrow_banner.hide_empty_narrow_message();
} }
} }
this.rerender_view(); this.rerender_view();

View File

@@ -6,7 +6,7 @@ import * as hash_util from "./hash_util";
import * as loading from "./loading"; import * as loading from "./loading";
import * as message_fetch from "./message_fetch"; import * as message_fetch from "./message_fetch";
import * as message_viewport from "./message_viewport"; import * as message_viewport from "./message_viewport";
import * as narrow from "./narrow"; import * as narrow_banner from "./narrow_banner";
import * as narrow_state from "./narrow_state"; import * as narrow_state from "./narrow_state";
import * as recent_topics from "./recent_topics"; import * as recent_topics from "./recent_topics";
import * as unread_ops from "./unread_ops"; import * as unread_ops from "./unread_ops";
@@ -65,7 +65,7 @@ export function hide_indicators() {
export function show_history_limit_notice() { export function show_history_limit_notice() {
$(".top-messages-logo").hide(); $(".top-messages-logo").hide();
$(".history-limited-box").show(); $(".history-limited-box").show();
narrow.hide_empty_narrow_message(); narrow_banner.hide_empty_narrow_message();
} }
export function hide_history_limit_notice() { export function hide_history_limit_notice() {

View File

@@ -9,7 +9,6 @@ import * as compose_state from "./compose_state";
import * as condense from "./condense"; import * as condense from "./condense";
import {Filter} from "./filter"; import {Filter} from "./filter";
import * as hashchange from "./hashchange"; import * as hashchange from "./hashchange";
import {i18n} from "./i18n";
import * as message_edit from "./message_edit"; import * as message_edit from "./message_edit";
import * as message_fetch from "./message_fetch"; import * as message_fetch from "./message_fetch";
import * as message_list from "./message_list"; import * as message_list from "./message_list";
@@ -17,6 +16,7 @@ import {MessageListData} from "./message_list_data";
import * as message_scroll from "./message_scroll"; import * as message_scroll from "./message_scroll";
import * as message_store from "./message_store"; import * as message_store from "./message_store";
import * as message_view_header from "./message_view_header"; import * as message_view_header from "./message_view_header";
import * as narrow_banner from "./narrow_banner";
import * as narrow_state from "./narrow_state"; import * as narrow_state from "./narrow_state";
import * as notifications from "./notifications"; import * as notifications from "./notifications";
import {page_params} from "./page_params"; import {page_params} from "./page_params";
@@ -847,7 +847,7 @@ export function deactivate(coming_from_recent_topics = false) {
narrow_state.reset_current_filter(); narrow_state.reset_current_filter();
hide_empty_narrow_message(); narrow_banner.hide_empty_narrow_message();
$("body").removeClass("narrowed_view"); $("body").removeClass("narrowed_view");
$("#zfilt").removeClass("focused_table"); $("#zfilt").removeClass("focused_table");
@@ -902,187 +902,3 @@ export function deactivate(coming_from_recent_topics = false) {
report_unnarrow_time(); report_unnarrow_time();
}); });
} }
function set_invalid_narrow_message(invalid_narrow_message) {
const search_string_display = $("#empty_search_stop_words_string");
search_string_display.text(invalid_narrow_message);
}
function show_search_query() {
// when search bar contains multiple filters, only show search queries
const current_filter = narrow_state.filter();
const search_query = current_filter.operands("search")[0];
const query_words = search_query.split(" ");
const search_string_display = $("#empty_search_stop_words_string");
let query_contains_stop_words = false;
// Also removes previous search_string if any
search_string_display.text(i18n.t("You searched for:"));
// Add in stream:foo and topic:bar if present
if (current_filter.has_operator("stream") || current_filter.has_operator("topic")) {
let stream_topic_string = "";
const stream = current_filter.operands("stream")[0];
const topic = current_filter.operands("topic")[0];
if (stream) {
stream_topic_string = "stream: " + stream;
}
if (topic) {
stream_topic_string = stream_topic_string + " topic: " + topic;
}
search_string_display.append(" ");
search_string_display.append($("<span>").text(stream_topic_string));
}
for (const query_word of query_words) {
search_string_display.append(" ");
// if query contains stop words, it is enclosed by a <del> tag
if (page_params.stop_words.includes(query_word)) {
// stop_words do not need sanitization so this is unnecessary but it is fail-safe.
search_string_display.append($("<del>").text(query_word));
query_contains_stop_words = true;
} else {
// We use .text("...") to sanitize the user-given query_string.
search_string_display.append($("<span>").text(query_word));
}
}
if (query_contains_stop_words) {
search_string_display.html(
i18n.t("Some common words were excluded from your search.") +
"<br/>" +
search_string_display.html(),
);
}
}
function pick_empty_narrow_banner() {
const default_banner = $("#empty_narrow_message");
const current_filter = narrow_state.filter();
if (current_filter === undefined) {
return default_banner;
}
const first_term = current_filter.operators()[0];
const first_operator = first_term.operator;
const first_operand = first_term.operand;
const num_operators = current_filter.operators().length;
if (num_operators !== 1) {
// For invalid-multi-operator narrows, we display an invalid narrow message
const streams = current_filter.operands("stream");
let invalid_narrow_message = "";
// No message can have multiple streams
if (streams.length > 1) {
invalid_narrow_message = i18n.t(
"You are searching for messages that belong to more than one stream, which is not possible.",
);
}
// No message can have multiple topics
if (current_filter.operands("topic").length > 1) {
invalid_narrow_message = i18n.t(
"You are searching for messages that belong to more than one topic, which is not possible.",
);
}
// No message can have multiple senders
if (current_filter.operands("sender").length > 1) {
invalid_narrow_message = i18n.t(
"You are searching for messages that are sent by more than one person, which is not possible.",
);
}
if (invalid_narrow_message !== "") {
set_invalid_narrow_message(invalid_narrow_message);
return $("#empty_search_narrow_message");
}
// For empty stream searches within other narrows, we display the stop words
if (current_filter.operands("search").length > 0) {
show_search_query();
return $("#empty_search_narrow_message");
}
// For other multi-operator narrows, we just use the default banner
return default_banner;
} else if (first_operator === "is") {
if (first_operand === "starred") {
// You have no starred messages.
return $("#empty_star_narrow_message");
} else if (first_operand === "mentioned") {
return $("#empty_narrow_all_mentioned");
} else if (first_operand === "private") {
// You have no private messages.
return $("#empty_narrow_all_private_message");
} else if (first_operand === "unread") {
// You have no unread messages.
return $("#no_unread_narrow_message");
}
} else if (first_operator === "stream" && !stream_data.is_subscribed(first_operand)) {
// You are narrowed to a stream which does not exist or is a private stream
// in which you were never subscribed.
function should_display_subscription_button() {
const stream_name = narrow_state.stream();
if (!stream_name) {
return false;
}
const stream_sub = stream_data.get_sub(first_operand);
return stream_sub && stream_sub.should_display_subscription_button;
}
if (should_display_subscription_button()) {
return $("#nonsubbed_stream_narrow_message");
}
return $("#nonsubbed_private_nonexistent_stream_narrow_message");
} else if (first_operator === "search") {
// You are narrowed to empty search results.
show_search_query();
return $("#empty_search_narrow_message");
} else if (first_operator === "pm-with") {
if (!people.is_valid_bulk_emails_for_compose(first_operand.split(","))) {
if (!first_operand.includes(",")) {
return $("#non_existing_user");
}
return $("#non_existing_users");
}
if (!first_operand.includes(",")) {
// You have no private messages with this person
if (people.is_current_user(first_operand)) {
return $("#empty_narrow_self_private_message");
}
return $("#empty_narrow_private_message");
}
return $("#empty_narrow_multi_private_message");
} else if (first_operator === "sender") {
if (people.get_by_email(first_operand)) {
return $("#silent_user");
}
return $("#non_existing_user");
} else if (first_operator === "group-pm-with") {
return $("#empty_narrow_group_private_message");
}
return default_banner;
}
export function show_empty_narrow_message() {
$(".empty_feed_notice").hide();
pick_empty_narrow_banner().show();
$("#left_bar_compose_reply_button_big").attr(
"title",
i18n.t("There are no messages to reply to."),
);
$("#left_bar_compose_reply_button_big").prop("disabled", true);
}
export function hide_empty_narrow_message() {
$(".empty_feed_notice").hide();
$("#left_bar_compose_reply_button_big").attr("title", i18n.t("Reply (r)"));
$("#left_bar_compose_reply_button_big").prop("disabled", false);
}

188
static/js/narrow_banner.js Normal file
View File

@@ -0,0 +1,188 @@
import $ from "jquery";
import {i18n} from "./i18n";
import * as narrow_state from "./narrow_state";
import {page_params} from "./page_params";
import * as people from "./people";
import * as stream_data from "./stream_data";
function set_invalid_narrow_message(invalid_narrow_message) {
const search_string_display = $("#empty_search_stop_words_string");
search_string_display.text(invalid_narrow_message);
}
function show_search_query() {
// when search bar contains multiple filters, only show search queries
const current_filter = narrow_state.filter();
const search_query = current_filter.operands("search")[0];
const query_words = search_query.split(" ");
const search_string_display = $("#empty_search_stop_words_string");
let query_contains_stop_words = false;
// Also removes previous search_string if any
search_string_display.text(i18n.t("You searched for:"));
// Add in stream:foo and topic:bar if present
if (current_filter.has_operator("stream") || current_filter.has_operator("topic")) {
let stream_topic_string = "";
const stream = current_filter.operands("stream")[0];
const topic = current_filter.operands("topic")[0];
if (stream) {
stream_topic_string = "stream: " + stream;
}
if (topic) {
stream_topic_string = stream_topic_string + " topic: " + topic;
}
search_string_display.append(" ");
search_string_display.append($("<span>").text(stream_topic_string));
}
for (const query_word of query_words) {
search_string_display.append(" ");
// if query contains stop words, it is enclosed by a <del> tag
if (page_params.stop_words.includes(query_word)) {
// stop_words do not need sanitization so this is unnecessary but it is fail-safe.
search_string_display.append($("<del>").text(query_word));
query_contains_stop_words = true;
} else {
// We use .text("...") to sanitize the user-given query_string.
search_string_display.append($("<span>").text(query_word));
}
}
if (query_contains_stop_words) {
const preamble = i18n.t("Some common words were excluded from your search.");
search_string_display.html(preamble + "<br/>" + search_string_display.html());
}
}
function pick_empty_narrow_banner() {
const default_banner = $("#empty_narrow_message");
const current_filter = narrow_state.filter();
if (current_filter === undefined) {
return default_banner;
}
const first_term = current_filter.operators()[0];
const first_operator = first_term.operator;
const first_operand = first_term.operand;
const num_operators = current_filter.operators().length;
if (num_operators !== 1) {
// For invalid-multi-operator narrows, we display an invalid narrow message
const streams = current_filter.operands("stream");
let invalid_narrow_message = "";
// No message can have multiple streams
if (streams.length > 1) {
invalid_narrow_message = i18n.t(
"You are searching for messages that belong to more than one stream, which is not possible.",
);
}
// No message can have multiple topics
if (current_filter.operands("topic").length > 1) {
invalid_narrow_message = i18n.t(
"You are searching for messages that belong to more than one topic, which is not possible.",
);
}
// No message can have multiple senders
if (current_filter.operands("sender").length > 1) {
invalid_narrow_message = i18n.t(
"You are searching for messages that are sent by more than one person, which is not possible.",
);
}
if (invalid_narrow_message !== "") {
set_invalid_narrow_message(invalid_narrow_message);
return $("#empty_search_narrow_message");
}
// For empty stream searches within other narrows, we display the stop words
if (current_filter.operands("search").length > 0) {
show_search_query();
return $("#empty_search_narrow_message");
}
// For other multi-operator narrows, we just use the default banner
return default_banner;
} else if (first_operator === "is") {
if (first_operand === "starred") {
// You have no starred messages.
return $("#empty_star_narrow_message");
} else if (first_operand === "mentioned") {
return $("#empty_narrow_all_mentioned");
} else if (first_operand === "private") {
// You have no private messages.
return $("#empty_narrow_all_private_message");
} else if (first_operand === "unread") {
// You have no unread messages.
return $("#no_unread_narrow_message");
}
} else if (first_operator === "stream" && !stream_data.is_subscribed(first_operand)) {
// You are narrowed to a stream which does not exist or is a private stream
// in which you were never subscribed.
function should_display_subscription_button() {
const stream_name = narrow_state.stream();
if (!stream_name) {
return false;
}
const stream_sub = stream_data.get_sub(first_operand);
return stream_sub && stream_sub.should_display_subscription_button;
}
if (should_display_subscription_button()) {
return $("#nonsubbed_stream_narrow_message");
}
return $("#nonsubbed_private_nonexistent_stream_narrow_message");
} else if (first_operator === "search") {
// You are narrowed to empty search results.
show_search_query();
return $("#empty_search_narrow_message");
} else if (first_operator === "pm-with") {
if (!people.is_valid_bulk_emails_for_compose(first_operand.split(","))) {
if (!first_operand.includes(",")) {
return $("#non_existing_user");
}
return $("#non_existing_users");
}
if (!first_operand.includes(",")) {
// You have no private messages with this person
if (people.is_current_user(first_operand)) {
return $("#empty_narrow_self_private_message");
}
return $("#empty_narrow_private_message");
}
return $("#empty_narrow_multi_private_message");
} else if (first_operator === "sender") {
if (people.get_by_email(first_operand)) {
return $("#silent_user");
}
return $("#non_existing_user");
} else if (first_operator === "group-pm-with") {
return $("#empty_narrow_group_private_message");
}
return default_banner;
}
export function show_empty_narrow_message() {
$(".empty_feed_notice").hide();
pick_empty_narrow_banner().show();
$("#left_bar_compose_reply_button_big").attr(
"title",
i18n.t("There are no messages to reply to."),
);
$("#left_bar_compose_reply_button_big").prop("disabled", true);
}
export function hide_empty_narrow_message() {
$(".empty_feed_notice").hide();
$("#left_bar_compose_reply_button_big").attr("title", i18n.t("Reply (r)"));
$("#left_bar_compose_reply_button_big").prop("disabled", false);
}

View File

@@ -132,12 +132,6 @@ js_rules = RuleList(
{ {
"pattern": r"i18n\.t\(.+\).*\+", "pattern": r"i18n\.t\(.+\).*\+",
"description": "Do not concatenate i18n strings", "description": "Do not concatenate i18n strings",
"exclude_line": {
(
"static/js/narrow.js",
'i18n.t("Some common words were excluded from your search.") +',
),
},
}, },
{"pattern": r"\+.*i18n\.t\(.+\)", "description": "Do not concatenate i18n strings"}, {"pattern": r"\+.*i18n\.t\(.+\)", "description": "Do not concatenate i18n strings"},
{ {

View File

@@ -90,6 +90,7 @@ EXEMPT_FILES = {
"static/js/message_viewport.js", "static/js/message_viewport.js",
"static/js/muting_ui.js", "static/js/muting_ui.js",
"static/js/narrow.js", "static/js/narrow.js",
"static/js/narrow_banner.js",
"static/js/navigate.js", "static/js/navigate.js",
"static/js/night_mode.js", "static/js/night_mode.js",
"static/js/notifications.js", "static/js/notifications.js",