util: Replace util.set_message_topic().

Replace `util.set_message_topic(message, topic)` with `message.topic =
topic`.

Fixes #13931
This commit is contained in:
shubhamgupta2956
2020-02-19 07:14:17 +05:30
committed by showell
parent efda2684ea
commit a05f633fc1
7 changed files with 7 additions and 13 deletions

View File

@@ -172,7 +172,7 @@ function create_message_object() {
queue_id: page_params.queue_id,
stream: '',
};
util.set_message_topic(message, '');
message.topic = '';
if (message.type === "private") {
// TODO: this should be collapsed with the code in composebox_typeahead.js
@@ -207,7 +207,7 @@ function create_message_object() {
blueslip.error('Trying to send message with bad stream name: ' + stream_name);
message.to = stream_name;
}
util.set_message_topic(message, topic);
message.topic = topic;
}
return message;
}

View File

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

View File

@@ -1,4 +1,3 @@
const util = require("./util");
const render_message_edit_form = require('../templates/message_edit_form.hbs');
const render_message_edit_history = require('../templates/message_edit_history.hbs');
const render_topic_edit_form = require('../templates/topic_edit_form.hbs');
@@ -496,7 +495,7 @@ exports.save = function (row, from_topic_edited_only) {
const request = {message_id: message.id};
if (topic_changed) {
util.set_message_topic(request, new_topic);
request.topic = new_topic;
if (feature_flags.propagate_topic_edits) {
const selected_topic_propagation = row.find("select.message_edit_topic_propagate").val() || "change_later";
request.propagate_mode = selected_topic_propagation;

View File

@@ -196,7 +196,7 @@ exports.update_messages = function update_messages(events) {
// before we call set_message_topic.
unread.update_unread_topics(msg, event);
util.set_message_topic(msg, new_topic);
msg.topic = new_topic;
msg.topic_links = event.topic_links;
// Add the recent topics entry for the new topics; must

View File

@@ -125,7 +125,7 @@ exports.do_set_reminder_for_message = function (message_id, timestamp) {
sender_id: page_params.user_id,
stream: '',
};
util.set_message_topic(reminder_message, '');
reminder_message.topic = '';
const recipient = page_params.email;
const emails = util.extract_pm_recipients(recipient);

View File

@@ -1,4 +1,3 @@
const util = require("./util");
function send_message_ajax(request, success, error) {
channel.post({
url: '/json/messages',
@@ -83,7 +82,7 @@ exports.reply_message = function (opts) {
reply.type = 'stream';
reply.to = stream;
reply.content = content;
util.set_message_topic(reply, message.topic);
reply.topic = message.topic;
exports.send_message(reply, success, error);
return;

View File

@@ -252,10 +252,6 @@ exports.get_reload_topic = function (obj) {
return obj.topic || obj.subject || '';
};
exports.set_message_topic = function (obj, topic) {
obj.topic = topic;
};
exports.get_edit_event_topic = function (obj) {
if (obj.topic === undefined) {
return obj.subject;