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: Don't narrow to recipient on "Undo".

Aman Agrawal36cb0f8a61f9
diff --git a/web/src/scheduled_messages.js b/web/src/scheduled_messages.js
index 9c528583feb..cdd8b656bff 100644
--- a/web/src/scheduled_messages.js
+++ b/web/src/scheduled_messages.js
@@ -84,7 +84,23 @@ export function update_scheduled_message(scheduled_message) {
sort_scheduled_messages_data();
}
-export function open_scheduled_message_in_compose(scheduled_msg) {
+function narrow_via_edit_scheduled_message(compose_args) {
+ if (compose_args.type === "stream") {
+ narrow.activate(
+ [
+ {operator: "stream", operand: compose_args.stream},
+ {operator: "topic", operand: compose_args.topic},
+ ],
+ {trigger: "edit scheduled message"},
+ );
+ } else {
+ narrow.activate([{operator: "dm", operand: compose_args.private_message_recipient}], {
+ trigger: "edit scheduled message",
+ });
+ }
+}
+
+export function open_scheduled_message_in_compose(scheduled_msg, should_narrow_to_recipient) {
let compose_args;
if (scheduled_msg.type === "stream") {
compose_args = {
@@ -107,18 +123,8 @@ export function open_scheduled_message_in_compose(scheduled_msg) {
};
}
- if (compose_args.type === "stream") {
- narrow.activate(
- [
- {operator: "stream", operand: compose_args.stream},
- {operator: "topic", operand: compose_args.topic},
- ],
- {trigger: "edit scheduled message"},
- );
- } else {
- narrow.activate([{operator: "dm", operand: compose_args.private_message_recipient}], {
- trigger: "edit scheduled message",
- });
+ if (should_narrow_to_recipient) {
+ narrow_via_edit_scheduled_message(compose_args);
}
compose.clear_compose_box();
@@ -160,12 +166,12 @@ export function send_request_to_schedule_message(scheduled_message_data, deliver
});
}
-export function edit_scheduled_message(scheduled_message_id) {
+export function edit_scheduled_message(scheduled_message_id, should_narrow_to_recipient = true) {
const scheduled_msg = scheduled_messages_data.find(
(msg) => msg.scheduled_message_id === scheduled_message_id,
);
delete_scheduled_message(scheduled_message_id, () =>
- open_scheduled_message_in_compose(scheduled_msg),
+ open_scheduled_message_in_compose(scheduled_msg, should_narrow_to_recipient),
);
}
@@ -244,7 +250,8 @@ export function initialize(scheduled_messages_params) {
.attr("data-scheduled-message-id"),
10,
);
- edit_scheduled_message(scheduled_message_id);
+ const should_narrow_to_recipient = false;
+ edit_scheduled_message(scheduled_message_id, should_narrow_to_recipient);
e.preventDefault();
e.stopPropagation();
});