mirror of
https://github.com/zulip/zulip.git
synced 2025-11-07 15:33:30 +00:00
scheduled_messages: Add left sidebar count.
This commit introduces logic to present a message count with the Scheduled messages item in the left sidebar. The count is present on the initial load, and is updated as a user adds or removes scheduled messages.
This commit is contained in:
@@ -140,6 +140,10 @@ export function delete_scheduled_message(scheduled_msg_id, success = () => {}) {
|
||||
});
|
||||
}
|
||||
|
||||
export function get_count() {
|
||||
return scheduled_messages_data.length;
|
||||
}
|
||||
|
||||
export function initialize(scheduled_messages_params) {
|
||||
scheduled_messages_data = scheduled_messages_params.scheduled_messages;
|
||||
|
||||
|
||||
@@ -69,6 +69,7 @@ import * as stream_topic_history from "./stream_topic_history";
|
||||
import * as stream_ui_updates from "./stream_ui_updates";
|
||||
import * as sub_store from "./sub_store";
|
||||
import * as submessage from "./submessage";
|
||||
import * as top_left_corner from "./top_left_corner";
|
||||
import * as typing_events from "./typing_events";
|
||||
import * as unread_ops from "./unread_ops";
|
||||
import * as unread_ui from "./unread_ui";
|
||||
@@ -473,6 +474,7 @@ export function dispatch_normal_event(event) {
|
||||
case "add": {
|
||||
scheduled_messages.add_scheduled_messages(event.scheduled_messages);
|
||||
scheduled_messages_overlay_ui.rerender();
|
||||
top_left_corner.update_scheduled_messages_row();
|
||||
break;
|
||||
}
|
||||
case "remove": {
|
||||
@@ -480,11 +482,13 @@ export function dispatch_normal_event(event) {
|
||||
scheduled_messages_overlay_ui.remove_scheduled_message_id(
|
||||
event.scheduled_message_id,
|
||||
);
|
||||
top_left_corner.update_scheduled_messages_row();
|
||||
break;
|
||||
}
|
||||
case "update": {
|
||||
scheduled_messages.update_scheduled_message(event.scheduled_message);
|
||||
scheduled_messages_overlay_ui.rerender();
|
||||
top_left_corner.update_scheduled_messages_row();
|
||||
break;
|
||||
}
|
||||
// No default
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import $ from "jquery";
|
||||
|
||||
import * as resize from "./resize";
|
||||
import * as scheduled_messages from "./scheduled_messages";
|
||||
import * as ui_util from "./ui_util";
|
||||
|
||||
let last_mention_count = 0;
|
||||
@@ -10,6 +11,12 @@ export function update_starred_count(count) {
|
||||
ui_util.update_unread_count_in_dom($starred_li, count);
|
||||
}
|
||||
|
||||
export function update_scheduled_messages_row() {
|
||||
const $scheduled_li = $(".top_left_scheduled_messages");
|
||||
const count = scheduled_messages.get_count();
|
||||
ui_util.update_unread_count_in_dom($scheduled_li, count);
|
||||
}
|
||||
|
||||
export function update_dom_with_unread_counts(counts) {
|
||||
// Note that "Private messages" counts are handled in pm_list.js.
|
||||
|
||||
@@ -99,3 +106,7 @@ function do_new_messages_animation($li) {
|
||||
setTimeout(mid_animation, 3000);
|
||||
setTimeout(end_animation, 6000);
|
||||
}
|
||||
|
||||
export function initialize() {
|
||||
update_scheduled_messages_row();
|
||||
}
|
||||
|
||||
@@ -100,6 +100,7 @@ import * as stream_list_sort from "./stream_list_sort";
|
||||
import * as stream_settings_ui from "./stream_settings_ui";
|
||||
import * as timerender from "./timerender";
|
||||
import * as tippyjs from "./tippyjs";
|
||||
import * as top_left_corner from "./top_left_corner";
|
||||
import * as topic_list from "./topic_list";
|
||||
import * as topic_zoom from "./topic_zoom";
|
||||
import * as tutorial from "./tutorial";
|
||||
@@ -649,6 +650,7 @@ export function initialize_everything() {
|
||||
muted_users.initialize(muted_users_params);
|
||||
stream_settings_ui.initialize();
|
||||
user_group_settings_ui.initialize();
|
||||
top_left_corner.initialize();
|
||||
stream_list.initialize();
|
||||
stream_list_sort.initialize();
|
||||
condense.initialize();
|
||||
|
||||
@@ -70,6 +70,7 @@ const stream_topic_history = mock_esm("../src/stream_topic_history");
|
||||
const submessage = mock_esm("../src/submessage");
|
||||
mock_esm("../src/top_left_corner", {
|
||||
update_starred_count() {},
|
||||
update_scheduled_messages_row() {},
|
||||
});
|
||||
const typing_events = mock_esm("../src/typing_events");
|
||||
const unread_ops = mock_esm("../src/unread_ops");
|
||||
|
||||
Reference in New Issue
Block a user