diff --git a/static/js/message_edit.js b/static/js/message_edit.js
index 5df0ad5f75..150503433e 100644
--- a/static/js/message_edit.js
+++ b/static/js/message_edit.js
@@ -6,6 +6,12 @@ const currently_editing_messages = new Map();
let currently_deleting_messages = [];
const currently_echoing_messages = new Map();
+// These variables are designed to preserve the user's most recent
+// choices when editing a group of messages, to make it convenient to
+// move several topics in a row with the same settings.
+exports.notify_old_thread_default = true;
+exports.notify_new_thread_default = true;
+
const editability_types = {
NO: 1,
NO_LONGER: 2,
@@ -283,6 +289,8 @@ function edit_message(row, raw_content) {
available_streams: available_streams,
stream_id: message.stream_id,
stream_name: message.stream,
+ notify_new_thread: exports.notify_new_thread_default,
+ notify_old_thread: exports.notify_old_thread_default,
}));
const edit_obj = {form: form, raw_content: raw_content};
@@ -298,6 +306,7 @@ function edit_message(row, raw_content) {
const message_edit_content = row.find('textarea.message_edit_content');
const message_edit_topic = row.find('input.message_edit_topic');
const message_edit_topic_propagate = row.find('select.message_edit_topic_propagate');
+ const message_edit_breadcrumb_messages = row.find('div.message_edit_breadcrumb_messages');
const message_edit_countdown_timer = row.find('.message_edit_countdown_timer');
const copy_message = row.find('.copy_message');
@@ -380,6 +389,7 @@ function edit_message(row, raw_content) {
if (message.type === 'stream') {
message_edit_topic.prop("readonly", "readonly");
message_edit_topic_propagate.hide();
+ message_edit_breadcrumb_messages.hide();
}
// We don't go directly to a "TOPIC_ONLY" type state (with an active Save button),
// since it isn't clear what to do with the half-finished edit. It's nice to keep
@@ -424,6 +434,7 @@ function edit_message(row, raw_content) {
const is_topic_edited = new_topic !== original_topic && new_topic !== "";
const is_stream_edited = new_stream_id !== original_stream_id;
message_edit_topic_propagate.toggle(is_topic_edited || is_stream_edited);
+ message_edit_breadcrumb_messages.toggle(is_stream_edited);
}
if (!message.locally_echoed) {
@@ -628,7 +639,13 @@ exports.save_message_row_edit = function (row) {
if (topic_changed || stream_changed) {
const selected_topic_propagation = row.find("select.message_edit_topic_propagate").val() || "change_later";
+ const send_notification_to_old_thread = row.find('.send_notification_to_old_thread').is(':checked');
+ const send_notification_to_new_thread = row.find('.send_notification_to_new_thread').is(':checked');
request.propagate_mode = selected_topic_propagation;
+ request.send_notification_to_old_thread = send_notification_to_old_thread;
+ request.send_notification_to_new_thread = send_notification_to_new_thread;
+ exports.notify_old_thread_default = send_notification_to_old_thread;
+ exports.notify_new_thread_default = send_notification_to_new_thread;
changed = true;
}
@@ -904,12 +921,17 @@ exports.handle_narrow_deactivated = function () {
};
exports.move_topic_containing_message_to_stream =
- function (message_id, new_stream_id, new_topic_name) {
+ function (message_id, new_stream_id, new_topic_name, send_notification_to_new_thread,
+ send_notification_to_old_thread) {
const request = {
stream_id: new_stream_id,
propagate_mode: 'change_all',
topic: new_topic_name,
+ send_notification_to_old_thread: send_notification_to_old_thread,
+ send_notification_to_new_thread: send_notification_to_new_thread,
};
+ exports.notify_old_thread_default = send_notification_to_old_thread;
+ exports.notify_new_thread_default = send_notification_to_new_thread;
channel.patch({
url: '/json/messages/' + message_id,
data: request,
diff --git a/static/js/stream_popover.js b/static/js/stream_popover.js
index 1454092496..d95a4562bc 100644
--- a/static/js/stream_popover.js
+++ b/static/js/stream_popover.js
@@ -273,7 +273,11 @@ function build_move_topic_to_stream_popover(e, current_stream_id, topic_name) {
// streams in the future.
const available_streams = stream_data.subscribed_subs()
.filter(s => s.stream_id !== current_stream_id);
- const args = { available_streams, topic_name, current_stream_id };
+ const args = {
+ available_streams, topic_name, current_stream_id,
+ notify_new_thread: message_edit.notify_new_thread_default,
+ notify_old_thread: message_edit.notify_old_thread_default,
+ };
exports.hide_topic_popover();
@@ -551,8 +555,11 @@ exports.register_topic_handlers = function () {
}, {});
const {old_topic_name, select_stream_id} = params;
- let {current_stream_id, new_topic_name} = params;
+ let {current_stream_id, new_topic_name,
+ send_notification_to_new_thread, send_notification_to_old_thread} = params;
new_topic_name = new_topic_name.trim();
+ send_notification_to_new_thread = send_notification_to_new_thread === 'on';
+ send_notification_to_old_thread = send_notification_to_old_thread === 'on';
current_stream_id = parseInt(current_stream_id, 10);
// The API endpoint for editing messages to change their
@@ -594,7 +601,9 @@ exports.register_topic_handlers = function () {
if (old_topic_name && select_stream_id) {
message_edit.move_topic_containing_message_to_stream(
- message_id, select_stream_id, new_topic_name);
+ message_id, select_stream_id, new_topic_name,
+ send_notification_to_new_thread,
+ send_notification_to_old_thread);
$('#move_topic_modal').modal('hide');
}
},
diff --git a/static/styles/zulip.scss b/static/styles/zulip.scss
index 7cbef11bd5..b22e0c224b 100644
--- a/static/styles/zulip.scss
+++ b/static/styles/zulip.scss
@@ -1358,6 +1358,31 @@ div.focused_table {
max-width: 100%;
}
+.topic_move_breadcrumb_messages,
+.message_edit_breadcrumb_messages {
+ display: inline-block;
+ margin: 0 5px 5px 0 !important;
+ align-self: center;
+
+ label.checkbox {
+ margin-right: 0 !important;
+
+ input {
+ margin: 0;
+ vertical-align: baseline;
+ }
+ }
+
+ label {
+ display: inline-block;
+ margin-right: 10px;
+ }
+}
+
+.topic_move_breadcrumb_messages {
+ margin-top: 10px !important;
+}
+
.message_length_controller {
display: none;
text-align: center;
diff --git a/static/templates/message_edit_form.hbs b/static/templates/message_edit_form.hbs
index ef3bf33fd6..d8e689e6af 100644
--- a/static/templates/message_edit_form.hbs
+++ b/static/templates/message_edit_form.hbs
@@ -18,6 +18,18 @@
+
+
+
+
+
+