From 7e17b8a39293cb60674cdb04fe95db34aa698408 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Sat, 22 Dec 2018 17:44:54 +0000 Subject: [PATCH] subject -> topic: Use util.set_message_topic() to set subject. --- frontend_tests/node_tests/transmit.js | 1 + static/js/echo.js | 2 +- static/js/message_edit.js | 2 +- static/js/message_events.js | 8 ++++---- static/js/reminder.js | 3 ++- static/js/transmit.js | 2 +- 6 files changed, 10 insertions(+), 8 deletions(-) diff --git a/frontend_tests/node_tests/transmit.js b/frontend_tests/node_tests/transmit.js index b38d1a79c3..2e57a87d7b 100644 --- a/frontend_tests/node_tests/transmit.js +++ b/frontend_tests/node_tests/transmit.js @@ -20,6 +20,7 @@ set_global('sent_messages', { set_global('blueslip', global.make_zblueslip()); zrequire('people'); +zrequire('util'); zrequire('transmit'); function test_with_mock_socket(test_params) { diff --git a/static/js/echo.js b/static/js/echo.js index fb7e1b59f1..24068a34ed 100644 --- a/static/js/echo.js +++ b/static/js/echo.js @@ -131,7 +131,7 @@ exports.edit_locally = function edit_locally(message, raw_content, new_topic) { topic_name: message.subject, }); - message.subject = new_topic; + util.set_message_topic(message, new_topic); topic_data.add_message({ stream_id: message.stream_id, diff --git a/static/js/message_edit.js b/static/js/message_edit.js index 28a2dae726..d811aab5e3 100644 --- a/static/js/message_edit.js +++ b/static/js/message_edit.js @@ -156,7 +156,7 @@ exports.save = function (row, from_topic_edited_only) { var request = {message_id: message.id}; if (topic_changed) { - request.subject = new_topic; + util.set_message_topic(request, new_topic); if (feature_flags.propagate_topic_edits) { var selected_topic_propagation = row.find("select.message_edit_topic_propagate").val() || "change_later"; request.propagate_mode = selected_topic_propagation; diff --git a/static/js/message_events.js b/static/js/message_events.js index b9a9c8af4e..db09a14d68 100644 --- a/static/js/message_events.js +++ b/static/js/message_events.js @@ -201,21 +201,21 @@ exports.update_messages = function update_messages(events) { } // Remove the recent topics entry for the old topics; - // must be called before we update msg.subject + // must be called before we call set_message_topic. topic_data.remove_message({ stream_id: msg.stream_id, topic_name: util.get_message_topic(msg), }); // Update the unread counts; again, this must be called - // before we update msg.subject + // before we call set_message_topic. unread.update_unread_topics(msg, event); - msg.subject = new_topic; + util.set_message_topic(msg, new_topic); util.set_topic_links(msg, util.get_topic_links(event)); // Add the recent topics entry for the new topics; must - // be called after we update msg.subject + // be called after we call set_message_topic. topic_data.add_message({ stream_id: msg.stream_id, topic_name: util.get_message_topic(msg), diff --git a/static/js/reminder.js b/static/js/reminder.js index dea0f22710..da48121d2b 100644 --- a/static/js/reminder.js +++ b/static/js/reminder.js @@ -136,8 +136,9 @@ exports.do_set_reminder_for_message = function (msgid, timestamp) { content: reminder_msg_content, sender_id: page_params.user_id, stream: '', - subject: '', }; + util.set_message_topic(reminder_message, ''); + var recipient = page_params.email; var emails = util.extract_pm_recipients(recipient); reminder_message.to = emails; diff --git a/static/js/transmit.js b/static/js/transmit.js index 9bcc13d5e7..400763b24e 100644 --- a/static/js/transmit.js +++ b/static/js/transmit.js @@ -112,7 +112,7 @@ exports.reply_message = function (opts) { reply.type = 'stream'; reply.to = stream; reply.content = content; - reply.subject = message.subject; + util.set_message_topic(reply, message.subject); transmit.send_message(reply, success, error); return;