subject -> topic: Use util.set_message_topic() to set subject.

This commit is contained in:
Steve Howell 2018-12-22 17:44:54 +00:00 committed by Tim Abbott
parent b4bc6b4445
commit 7e17b8a392
6 changed files with 10 additions and 8 deletions

View File

@ -20,6 +20,7 @@ set_global('sent_messages', {
set_global('blueslip', global.make_zblueslip()); set_global('blueslip', global.make_zblueslip());
zrequire('people'); zrequire('people');
zrequire('util');
zrequire('transmit'); zrequire('transmit');
function test_with_mock_socket(test_params) { function test_with_mock_socket(test_params) {

View File

@ -131,7 +131,7 @@ exports.edit_locally = function edit_locally(message, raw_content, new_topic) {
topic_name: message.subject, topic_name: message.subject,
}); });
message.subject = new_topic; util.set_message_topic(message, new_topic);
topic_data.add_message({ topic_data.add_message({
stream_id: message.stream_id, stream_id: message.stream_id,

View File

@ -156,7 +156,7 @@ exports.save = function (row, from_topic_edited_only) {
var request = {message_id: message.id}; var request = {message_id: message.id};
if (topic_changed) { if (topic_changed) {
request.subject = new_topic; util.set_message_topic(request, new_topic);
if (feature_flags.propagate_topic_edits) { if (feature_flags.propagate_topic_edits) {
var selected_topic_propagation = row.find("select.message_edit_topic_propagate").val() || "change_later"; var selected_topic_propagation = row.find("select.message_edit_topic_propagate").val() || "change_later";
request.propagate_mode = selected_topic_propagation; request.propagate_mode = selected_topic_propagation;

View File

@ -201,21 +201,21 @@ exports.update_messages = function update_messages(events) {
} }
// Remove the recent topics entry for the old topics; // 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({ topic_data.remove_message({
stream_id: msg.stream_id, stream_id: msg.stream_id,
topic_name: util.get_message_topic(msg), topic_name: util.get_message_topic(msg),
}); });
// Update the unread counts; again, this must be called // 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); 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)); util.set_topic_links(msg, util.get_topic_links(event));
// Add the recent topics entry for the new topics; must // 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({ topic_data.add_message({
stream_id: msg.stream_id, stream_id: msg.stream_id,
topic_name: util.get_message_topic(msg), topic_name: util.get_message_topic(msg),

View File

@ -136,8 +136,9 @@ exports.do_set_reminder_for_message = function (msgid, timestamp) {
content: reminder_msg_content, content: reminder_msg_content,
sender_id: page_params.user_id, sender_id: page_params.user_id,
stream: '', stream: '',
subject: '',
}; };
util.set_message_topic(reminder_message, '');
var recipient = page_params.email; var recipient = page_params.email;
var emails = util.extract_pm_recipients(recipient); var emails = util.extract_pm_recipients(recipient);
reminder_message.to = emails; reminder_message.to = emails;

View File

@ -112,7 +112,7 @@ exports.reply_message = function (opts) {
reply.type = 'stream'; reply.type = 'stream';
reply.to = stream; reply.to = stream;
reply.content = content; reply.content = content;
reply.subject = message.subject; util.set_message_topic(reply, message.subject);
transmit.send_message(reply, success, error); transmit.send_message(reply, success, error);
return; return;