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.

scheduled_messages: Use `scheduled_` prefix to identify scheduled msgs.

Aman Agrawale7859a556487
diff --git a/web/src/scheduled_messages_overlay_ui.ts b/web/src/scheduled_messages_overlay_ui.ts
index 6a11a4997ef..718300479a5 100644
--- a/web/src/scheduled_messages_overlay_ui.ts
+++ b/web/src/scheduled_messages_overlay_ui.ts
@@ -39,11 +39,11 @@ type ScheduledMessageRenderContext = ScheduledMessage &
export const keyboard_handling_context = {
get_items_ids() {
const scheduled_messages_ids = [];
- const sorted_messages = sort_scheduled_messages(
+ const sorted_scheduled_messages = sort_scheduled_messages(
scheduled_messages.get_all_scheduled_messages(),
);
- for (const message of sorted_messages) {
- scheduled_messages_ids.push(message.scheduled_message_id.toString());
+ for (const scheduled_message of sorted_scheduled_messages) {
+ scheduled_messages_ids.push(scheduled_message.scheduled_message_id.toString());
}
return scheduled_messages_ids;
},
@@ -74,10 +74,10 @@ export const keyboard_handling_context = {
};
function sort_scheduled_messages(scheduled_messages: ScheduledMessage[]): ScheduledMessage[] {
- const sorted_messages = scheduled_messages.sort(
+ const sorted_scheduled_messages = scheduled_messages.sort(
(msg1, msg2) => msg1.scheduled_delivery_timestamp - msg2.scheduled_delivery_timestamp,
);
- return sorted_messages;
+ return sorted_scheduled_messages;
}
export function handle_keyboard_events(event_key: string): void {
@@ -85,45 +85,45 @@ export function handle_keyboard_events(event_key: string): void {
}
function format(scheduled_messages: ScheduledMessage[]): ScheduledMessageRenderContext[] {
- const formatted_msgs = [];
- const sorted_messages = sort_scheduled_messages(scheduled_messages);
+ const formatted_scheduled_msgs = [];
+ const sorted_scheduled_messages = sort_scheduled_messages(scheduled_messages);
- for (const msg of sorted_messages) {
- let msg_render_context;
- const time = new Date(msg.scheduled_delivery_timestamp * 1000);
+ for (const scheduled_msg of sorted_scheduled_messages) {
+ let scheduled_msg_render_context;
+ const time = new Date(scheduled_msg.scheduled_delivery_timestamp * 1000);
const formatted_send_at_time = timerender.get_full_datetime(time, "time");
- if (msg.type === "stream") {
- const stream_id = msg.to;
+ if (scheduled_msg.type === "stream") {
+ const stream_id = scheduled_msg.to;
const stream_name = sub_store.maybe_get_stream_name(stream_id);
const color = stream_data.get_color(stream_id);
const recipient_bar_color = stream_color.get_recipient_bar_color(color);
const stream_privacy_icon_color = stream_color.get_stream_privacy_icon_color(color);
assert(stream_name !== undefined);
- msg_render_context = {
- ...msg,
+ scheduled_msg_render_context = {
+ ...scheduled_msg,
is_stream: true as const,
stream_id,
stream_name,
recipient_bar_color,
stream_privacy_icon_color,
formatted_send_at_time,
- topic_display_name: util.get_final_topic_display_name(msg.topic),
- is_empty_string_topic: msg.topic === "",
+ topic_display_name: util.get_final_topic_display_name(scheduled_msg.topic),
+ is_empty_string_topic: scheduled_msg.topic === "",
};
} else {
- const user_ids_string = msg.to.join(",");
+ const user_ids_string = scheduled_msg.to.join(",");
const recipients = people.format_recipients(user_ids_string, "long");
- msg_render_context = {
- ...msg,
+ scheduled_msg_render_context = {
+ ...scheduled_msg,
is_stream: false as const,
recipients,
formatted_send_at_time,
};
}
- formatted_msgs.push(msg_render_context);
+ formatted_scheduled_msgs.push(scheduled_msg_render_context);
}
- return formatted_msgs;
+ return formatted_scheduled_msgs;
}
export function launch(): void {
diff --git a/web/src/scheduled_messages_ui.ts b/web/src/scheduled_messages_ui.ts
index ede62fa6b9c..31e5773f791 100644
--- a/web/src/scheduled_messages_ui.ts
+++ b/web/src/scheduled_messages_ui.ts
@@ -52,22 +52,22 @@ function narrow_via_edit_scheduled_message(compose_args: ScheduledMessageCompose
}
export function open_scheduled_message_in_compose(
- scheduled_msg: ScheduledMessage,
+ scheduled_message: ScheduledMessage,
should_narrow_to_recipient?: boolean,
): void {
let compose_args;
let narrow_args;
- if (scheduled_msg.type === "stream") {
+ if (scheduled_message.type === "stream") {
compose_args = {
message_type: "stream" as const,
- stream_id: scheduled_msg.to,
- topic: scheduled_msg.topic,
- content: scheduled_msg.content,
+ stream_id: scheduled_message.to,
+ topic: scheduled_message.topic,
+ content: scheduled_message.content,
};
narrow_args = compose_args;
} else {
- const recipient_ids = scheduled_msg.to.filter(
+ const recipient_ids = scheduled_message.to.filter(
(recipient_id) => !people.get_by_user_id(recipient_id).is_inaccessible_user,
);
const recipient_emails = recipient_ids.map(
@@ -76,7 +76,7 @@ export function open_scheduled_message_in_compose(
compose_args = {
message_type: "private" as const,
private_message_recipient_ids: recipient_ids,
- content: scheduled_msg.content,
+ content: scheduled_message.content,
keep_composebox_empty: true,
};
// Narrow filters still use emails for PMs, though we'll
@@ -84,7 +84,7 @@ export function open_scheduled_message_in_compose(
narrow_args = {
message_type: "private" as const,
private_message_recipient: recipient_emails.join(","),
- content: scheduled_msg.content,
+ content: scheduled_message.content,
keep_composebox_empty: true,
};
}
@@ -94,7 +94,9 @@ export function open_scheduled_message_in_compose(
}
compose_actions.start(compose_args);
- scheduled_messages.set_selected_schedule_timestamp(scheduled_msg.scheduled_delivery_timestamp);
+ scheduled_messages.set_selected_schedule_timestamp(
+ scheduled_message.scheduled_delivery_timestamp,
+ );
}
function show_message_unscheduled_banner(scheduled_delivery_timestamp: number): void {
@@ -120,12 +122,12 @@ export function edit_scheduled_message(
scheduled_message_id: number,
should_narrow_to_recipient = true,
): void {
- const scheduled_msg = scheduled_messages.scheduled_messages_by_id.get(scheduled_message_id);
- assert(scheduled_msg !== undefined);
+ const scheduled_message = scheduled_messages.scheduled_messages_by_id.get(scheduled_message_id);
+ assert(scheduled_message !== undefined);
scheduled_messages.delete_scheduled_message(scheduled_message_id, () => {
- open_scheduled_message_in_compose(scheduled_msg, should_narrow_to_recipient);
- show_message_unscheduled_banner(scheduled_msg.scheduled_delivery_timestamp);
+ open_scheduled_message_in_compose(scheduled_message, should_narrow_to_recipient);
+ show_message_unscheduled_banner(scheduled_message.scheduled_delivery_timestamp);
});
}