mirror of https://github.com/zulip/zulip.git
recent: Rename recent_topics_util.
This commit is contained in:
parent
f8db06569f
commit
3c16541eb4
|
@ -147,7 +147,7 @@ EXEMPT_FILES = make_set(
|
|||
"web/src/realm_playground.ts",
|
||||
"web/src/realm_user_settings_defaults.ts",
|
||||
"web/src/recent_view_ui.js",
|
||||
"web/src/recent_topics_util.js",
|
||||
"web/src/recent_view_util.js",
|
||||
"web/src/reload.js",
|
||||
"web/src/reminder.js",
|
||||
"web/src/resize.js",
|
||||
|
|
|
@ -22,7 +22,7 @@ import * as narrow_state from "./narrow_state";
|
|||
import {page_params} from "./page_params";
|
||||
import * as people from "./people";
|
||||
import * as recent_view_ui from "./recent_view_ui";
|
||||
import * as recent_topics_util from "./recent_topics_util";
|
||||
import * as recent_view_util from "./recent_view_util";
|
||||
import * as reload_state from "./reload_state";
|
||||
import * as resize from "./resize";
|
||||
import * as settings_config from "./settings_config";
|
||||
|
@ -307,7 +307,7 @@ export function cancel() {
|
|||
export function respond_to_message(opts) {
|
||||
let message;
|
||||
let msg_type;
|
||||
if (recent_topics_util.is_visible()) {
|
||||
if (recent_view_util.is_visible()) {
|
||||
message = recent_view_ui.get_focused_row_message();
|
||||
if (message === undefined) {
|
||||
// Open empty compose with nothing pre-filled since
|
||||
|
|
|
@ -18,7 +18,7 @@ import * as overlays from "./overlays";
|
|||
import {page_params} from "./page_params";
|
||||
import * as popovers from "./popovers";
|
||||
import * as recent_view_ui from "./recent_view_ui";
|
||||
import * as recent_topics_util from "./recent_topics_util";
|
||||
import * as recent_view_util from "./recent_view_util";
|
||||
import * as scheduled_messages_overlay_ui from "./scheduled_messages_overlay_ui";
|
||||
import * as settings from "./settings";
|
||||
import * as settings_panel_menu from "./settings_panel_menu";
|
||||
|
@ -84,7 +84,7 @@ function set_hash(hash) {
|
|||
}
|
||||
|
||||
function maybe_hide_recent_topics() {
|
||||
if (recent_topics_util.is_visible()) {
|
||||
if (recent_view_util.is_visible()) {
|
||||
recent_view_ui.hide();
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ import * as popover_menus from "./popover_menus";
|
|||
import * as popovers from "./popovers";
|
||||
import * as reactions from "./reactions";
|
||||
import * as recent_view_ui from "./recent_view_ui";
|
||||
import * as recent_topics_util from "./recent_topics_util";
|
||||
import * as recent_view_util from "./recent_view_util";
|
||||
import * as scheduled_messages_overlay_ui from "./scheduled_messages_overlay_ui";
|
||||
import * as search from "./search";
|
||||
import * as settings_data from "./settings_data";
|
||||
|
@ -482,7 +482,7 @@ export function process_enter_key(e) {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (recent_topics_util.is_visible()) {
|
||||
if (recent_view_util.is_visible()) {
|
||||
if (e.target === $("body")[0]) {
|
||||
// There's a race when using `Esc` and `Enter` to navigate to
|
||||
// Recent Conversations and then navigate to the next topic, wherein
|
||||
|
|
|
@ -21,8 +21,8 @@ import * as notifications from "./notifications";
|
|||
import {page_params} from "./page_params";
|
||||
import * as pm_list from "./pm_list";
|
||||
import * as recent_senders from "./recent_senders";
|
||||
import * as recent_topics_util from "./recent_topics_util";
|
||||
import * as recent_view_ui from "./recent_view_ui";
|
||||
import * as recent_view_util from "./recent_view_util";
|
||||
import * as starred_messages from "./starred_messages";
|
||||
import * as starred_messages_ui from "./starred_messages_ui";
|
||||
import * as stream_list from "./stream_list";
|
||||
|
@ -232,7 +232,7 @@ export function update_messages(events) {
|
|||
}
|
||||
|
||||
if (unread.update_message_for_mention(anchor_message, any_message_content_edited)) {
|
||||
const topic_key = recent_topics_util.get_topic_key(
|
||||
const topic_key = recent_view_util.get_topic_key(
|
||||
anchor_message.stream_id,
|
||||
anchor_message.topic,
|
||||
);
|
||||
|
|
|
@ -2,7 +2,7 @@ import $ from "jquery";
|
|||
|
||||
import {Filter} from "./filter";
|
||||
import * as message_list from "./message_list";
|
||||
import * as recent_topics_util from "./recent_topics_util";
|
||||
import * as recent_view_util from "./recent_view_util";
|
||||
import * as ui_util from "./ui_util";
|
||||
|
||||
export let home;
|
||||
|
@ -14,7 +14,7 @@ export function set_current(msg_list) {
|
|||
|
||||
export function all_rendered_message_lists() {
|
||||
const rendered_message_lists = [home];
|
||||
if (current !== home && !recent_topics_util.is_visible()) {
|
||||
if (current !== home && !recent_view_util.is_visible()) {
|
||||
rendered_message_lists.push(current);
|
||||
}
|
||||
return rendered_message_lists;
|
||||
|
|
|
@ -6,7 +6,7 @@ import {$t} from "./i18n";
|
|||
import * as narrow_state from "./narrow_state";
|
||||
import * as peer_data from "./peer_data";
|
||||
import * as popovers from "./popovers";
|
||||
import * as recent_topics_util from "./recent_topics_util";
|
||||
import * as recent_view_util from "./recent_view_util";
|
||||
import * as rendered_markdown from "./rendered_markdown";
|
||||
import * as search from "./search";
|
||||
|
||||
|
@ -20,7 +20,7 @@ function get_formatted_sub_count(sub_count) {
|
|||
|
||||
function make_message_view_header(filter) {
|
||||
const message_view_header = {};
|
||||
if (recent_topics_util.is_visible()) {
|
||||
if (recent_view_util.is_visible()) {
|
||||
return {
|
||||
title: $t({defaultMessage: "Recent conversations"}),
|
||||
icon: "clock-o",
|
||||
|
|
|
@ -33,8 +33,8 @@ import * as notifications from "./notifications";
|
|||
import {page_params} from "./page_params";
|
||||
import * as people from "./people";
|
||||
import * as pm_list from "./pm_list";
|
||||
import * as recent_topics_util from "./recent_topics_util";
|
||||
import * as recent_view_ui from "./recent_view_ui";
|
||||
import * as recent_view_util from "./recent_view_util";
|
||||
import * as resize from "./resize";
|
||||
import * as search from "./search";
|
||||
import {web_mark_read_on_scroll_policy_values} from "./settings_config";
|
||||
|
@ -77,7 +77,7 @@ export function compute_narrow_title(filter) {
|
|||
if (filter === undefined) {
|
||||
// "All messages" and "Recent conversations" views have
|
||||
// an `undefined` filter.
|
||||
if (recent_topics_util.is_visible()) {
|
||||
if (recent_view_util.is_visible()) {
|
||||
return $t({defaultMessage: "Recent conversations"});
|
||||
}
|
||||
return $t({defaultMessage: "All messages"});
|
||||
|
@ -193,7 +193,7 @@ export function activate(raw_operators, opts) {
|
|||
return;
|
||||
}
|
||||
|
||||
const coming_from_recent_topics = recent_topics_util.is_visible();
|
||||
const coming_from_recent_topics = recent_view_util.is_visible();
|
||||
|
||||
// The empty narrow is the home view; so deactivate any narrow if
|
||||
// no operators were specified. Take us to all messages when this
|
||||
|
|
|
@ -2,7 +2,7 @@ import * as blueslip from "./blueslip";
|
|||
import {Filter} from "./filter";
|
||||
import {page_params} from "./page_params";
|
||||
import * as people from "./people";
|
||||
import * as recent_topics_util from "./recent_topics_util";
|
||||
import * as recent_view_util from "./recent_view_util";
|
||||
import * as stream_data from "./stream_data";
|
||||
import * as unread from "./unread";
|
||||
|
||||
|
@ -34,7 +34,7 @@ export function operators() {
|
|||
}
|
||||
|
||||
export function is_message_feed_visible() {
|
||||
return !recent_topics_util.is_visible();
|
||||
return !recent_view_util.is_visible();
|
||||
}
|
||||
|
||||
export function update_email(user_id, new_email) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import * as people from "./people";
|
||||
import {get_key_from_message} from "./recent_topics_util";
|
||||
import {get_key_from_message} from "./recent_view_util";
|
||||
|
||||
export const topics = new Map();
|
||||
// For stream messages, key is stream-id:topic.
|
||||
|
|
|
@ -30,7 +30,7 @@ import * as pm_list from "./pm_list";
|
|||
import * as popovers from "./popovers";
|
||||
import * as recent_senders from "./recent_senders";
|
||||
import {get, process_message, topics} from "./recent_topics_data";
|
||||
import {get_key_from_message, get_topic_key, is_visible, set_visible} from "./recent_topics_util";
|
||||
import {get_key_from_message, get_topic_key, is_visible, set_visible} from "./recent_view_util";
|
||||
import * as resize from "./resize";
|
||||
import * as scroll_util from "./scroll_util";
|
||||
import * as search from "./search";
|
||||
|
|
|
@ -2,7 +2,7 @@ import * as blueslip from "./blueslip";
|
|||
import {FoldDict} from "./fold_dict";
|
||||
import * as message_store from "./message_store";
|
||||
import * as people from "./people";
|
||||
import * as recent_topics_util from "./recent_topics_util";
|
||||
import * as recent_view_util from "./recent_view_util";
|
||||
import * as settings_config from "./settings_config";
|
||||
import * as stream_data from "./stream_data";
|
||||
import * as sub_store from "./sub_store";
|
||||
|
@ -39,7 +39,7 @@ const unread_messages = new Set();
|
|||
|
||||
// Map with keys of the form "{stream_id}:{topic.toLowerCase()}" and
|
||||
// values being Sets of message IDs for unread messages mentioning the
|
||||
// user within that topic. Use `recent_topics_util.get_topic_key` to
|
||||
// user within that topic. Use `recent_view_util.get_topic_key` to
|
||||
// calculate keys.
|
||||
//
|
||||
// Functionally a cache; see clear_and_populate_unread_mention_topics
|
||||
|
@ -499,7 +499,7 @@ function add_message_to_unread_mention_topics(message_id) {
|
|||
if (message.type !== "stream") {
|
||||
return;
|
||||
}
|
||||
const topic_key = recent_topics_util.get_topic_key(message.stream_id, message.topic);
|
||||
const topic_key = recent_view_util.get_topic_key(message.stream_id, message.topic);
|
||||
if (unread_mention_topics.has(topic_key)) {
|
||||
unread_mention_topics.get(topic_key).add(message_id);
|
||||
}
|
||||
|
@ -521,7 +521,7 @@ function remove_message_from_unread_mention_topics(message_id) {
|
|||
}
|
||||
|
||||
const topic = per_stream_bucketer.reverse_lookup.get(message_id);
|
||||
const topic_key = recent_topics_util.get_topic_key(stream_id, topic);
|
||||
const topic_key = recent_view_util.get_topic_key(stream_id, topic);
|
||||
if (unread_mention_topics.has(topic_key)) {
|
||||
unread_mention_topics.get(topic_key).delete(message_id);
|
||||
}
|
||||
|
@ -549,7 +549,7 @@ export function clear_and_populate_unread_mention_topics() {
|
|||
}
|
||||
const per_stream_bucketer = unread_topic_counter.bucketer.get_bucket(stream_id);
|
||||
const topic = per_stream_bucketer.reverse_lookup.get(message_id);
|
||||
const topic_key = recent_topics_util.get_topic_key(stream_id, topic);
|
||||
const topic_key = recent_view_util.get_topic_key(stream_id, topic);
|
||||
if (unread_mention_topics.has(topic_key)) {
|
||||
unread_mention_topics.get(topic_key).add(message_id);
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ const narrow_state = mock_esm("../src/narrow_state", {
|
|||
mock_esm("../src/reload_state", {
|
||||
is_in_progress: () => false,
|
||||
});
|
||||
mock_esm("../src/recent_topics_util", {
|
||||
mock_esm("../src/recent_view_util", {
|
||||
is_visible: noop,
|
||||
});
|
||||
mock_esm("../src/drafts", {
|
||||
|
|
|
@ -7,7 +7,7 @@ const {mock_esm, set_global, zrequire} = require("./lib/namespace");
|
|||
const {run_test} = require("./lib/test");
|
||||
const $ = require("./lib/zjquery");
|
||||
|
||||
mock_esm("../src/recent_topics_util", {
|
||||
mock_esm("../src/recent_view_util", {
|
||||
is_visible: () => false,
|
||||
});
|
||||
const noop = () => {};
|
||||
|
|
|
@ -63,7 +63,7 @@ message_lists.home = {view: {}};
|
|||
message_lists.all_rendered_message_lists = () => [message_lists.home, message_lists.current];
|
||||
|
||||
const message_store = zrequire("message_store");
|
||||
const recent_topics_util = zrequire("recent_topics_util");
|
||||
const recent_view_util = zrequire("recent_view_util");
|
||||
const stream_data = zrequire("stream_data");
|
||||
const unread = zrequire("unread");
|
||||
const unread_ops = zrequire("unread_ops");
|
||||
|
@ -93,7 +93,7 @@ run_test("unread_ops", ({override}) => {
|
|||
];
|
||||
|
||||
// We don't want Recent Conversations to process message for this test.
|
||||
recent_topics_util.set_visible(false);
|
||||
recent_view_util.set_visible(false);
|
||||
|
||||
// Make our test message appear to be unread, so that
|
||||
// we then need to subsequently process them as read.
|
||||
|
|
|
@ -23,7 +23,7 @@ const compose_pm_pill = mock_esm("../src/compose_pm_pill");
|
|||
mock_esm("../src/spectators", {
|
||||
login_to_access() {},
|
||||
});
|
||||
const recent_topics_util = mock_esm("../src/recent_topics_util", {
|
||||
const recent_view_util = mock_esm("../src/recent_view_util", {
|
||||
is_visible() {},
|
||||
});
|
||||
|
||||
|
@ -775,10 +775,10 @@ run_test("narrow_compute_title", ({override}) => {
|
|||
|
||||
// Recent conversations & All messages have `undefined` filter.
|
||||
filter = undefined;
|
||||
override(recent_topics_util, "is_visible", () => true);
|
||||
override(recent_view_util, "is_visible", () => true);
|
||||
assert.equal(narrow.compute_narrow_title(filter), "translated: Recent conversations");
|
||||
|
||||
override(recent_topics_util, "is_visible", () => false);
|
||||
override(recent_view_util, "is_visible", () => false);
|
||||
assert.equal(narrow.compute_narrow_title(filter), "translated: All messages");
|
||||
|
||||
// Search & uncommon narrows
|
||||
|
|
|
@ -34,7 +34,7 @@ const stream_list = mock_esm("../src/stream_list");
|
|||
const left_sidebar_navigation_area = mock_esm("../src/left_sidebar_navigation_area");
|
||||
const typing_events = mock_esm("../src/typing_events");
|
||||
const unread_ops = mock_esm("../src/unread_ops");
|
||||
mock_esm("../src/recent_topics_util", {
|
||||
mock_esm("../src/recent_view_util", {
|
||||
is_visible() {},
|
||||
});
|
||||
mock_esm("../src/pm_list", {
|
||||
|
|
|
@ -192,7 +192,7 @@ mock_esm("../src/resize", {
|
|||
const {all_messages_data} = zrequire("all_messages_data");
|
||||
const people = zrequire("people");
|
||||
const rt = zrequire("recent_view_ui");
|
||||
const recent_topics_util = zrequire("recent_topics_util");
|
||||
const recent_view_util = zrequire("recent_view_util");
|
||||
const rt_data = zrequire("recent_topics_data");
|
||||
const muted_users = zrequire("muted_users");
|
||||
|
||||
|
@ -479,7 +479,7 @@ test("test_filter_all", ({mock_template}) => {
|
|||
i = row_data.length;
|
||||
rt.clear_for_tests();
|
||||
stub_out_filter_buttons();
|
||||
recent_topics_util.set_visible(true);
|
||||
recent_view_util.set_visible(true);
|
||||
rt.set_filter("all");
|
||||
rt.process_messages([messages[0]]);
|
||||
|
||||
|
@ -538,7 +538,7 @@ test("test_filter_pm", ({mock_template}) => {
|
|||
|
||||
rt.clear_for_tests();
|
||||
stub_out_filter_buttons();
|
||||
recent_topics_util.set_visible(true);
|
||||
recent_view_util.set_visible(true);
|
||||
rt.set_filter("include_private");
|
||||
|
||||
expected_data_to_replace_in_list_widget = [
|
||||
|
@ -597,7 +597,7 @@ test("test_filter_unread", ({mock_template}) => {
|
|||
});
|
||||
|
||||
rt.clear_for_tests();
|
||||
recent_topics_util.set_visible(true);
|
||||
recent_view_util.set_visible(true);
|
||||
rt.set_default_focus();
|
||||
|
||||
stub_out_filter_buttons();
|
||||
|
@ -718,7 +718,7 @@ test("test_filter_participated", ({mock_template}) => {
|
|||
});
|
||||
|
||||
rt.clear_for_tests();
|
||||
recent_topics_util.set_visible(true);
|
||||
recent_view_util.set_visible(true);
|
||||
rt.set_default_focus();
|
||||
stub_out_filter_buttons();
|
||||
expected_filter_participated = false;
|
||||
|
@ -799,7 +799,7 @@ test("test_filter_participated", ({mock_template}) => {
|
|||
});
|
||||
|
||||
test("test_update_unread_count", () => {
|
||||
recent_topics_util.set_visible(false);
|
||||
recent_view_util.set_visible(false);
|
||||
rt.clear_for_tests();
|
||||
stub_out_filter_buttons();
|
||||
rt.set_filter("all");
|
||||
|
@ -820,7 +820,7 @@ test("basic assertions", ({mock_template, override_rewire}) => {
|
|||
});
|
||||
|
||||
stub_out_filter_buttons();
|
||||
recent_topics_util.set_visible(true);
|
||||
recent_view_util.set_visible(true);
|
||||
rt.set_default_focus();
|
||||
rt.set_filter("all");
|
||||
rt.process_messages(messages);
|
||||
|
@ -949,7 +949,7 @@ test("test_reify_local_echo_message", ({mock_template}) => {
|
|||
|
||||
rt.clear_for_tests();
|
||||
stub_out_filter_buttons();
|
||||
recent_topics_util.set_visible(true);
|
||||
recent_view_util.set_visible(true);
|
||||
rt.set_filter("all");
|
||||
rt.process_messages(messages);
|
||||
|
||||
|
@ -996,7 +996,7 @@ test("test_reify_local_echo_message", ({mock_template}) => {
|
|||
});
|
||||
|
||||
test("test_delete_messages", ({override}) => {
|
||||
recent_topics_util.set_visible(false);
|
||||
recent_view_util.set_visible(false);
|
||||
rt.clear_for_tests();
|
||||
stub_out_filter_buttons();
|
||||
rt.set_filter("all");
|
||||
|
@ -1036,7 +1036,7 @@ test("test_delete_messages", ({override}) => {
|
|||
|
||||
test("test_topic_edit", ({override}) => {
|
||||
override(all_messages_data, "all_messages", () => messages);
|
||||
recent_topics_util.set_visible(false);
|
||||
recent_view_util.set_visible(false);
|
||||
|
||||
// NOTE: This test should always run in the end as it modified the messages data.
|
||||
rt.clear_for_tests();
|
||||
|
|
Loading…
Reference in New Issue