util: Replace util.get_message_topic().

Replace `util.get_message_topic(message)` with `message.topic`.

Fixes #13931
This commit is contained in:
shubhamgupta2956
2020-02-19 04:34:12 +05:30
committed by showell
parent 9d598d95a6
commit efda2684ea
18 changed files with 32 additions and 69 deletions

View File

@@ -59,10 +59,7 @@ function lower_same(a, b) {
exports.same_stream_and_topic = function util_same_stream_and_topic(a, b) {
// Streams and topics are case-insensitive.
return a.stream_id === b.stream_id &&
lower_same(
exports.get_message_topic(a),
exports.get_message_topic(b)
);
lower_same(a.topic, b.topic);
};
exports.is_pm_recipient = function (email, message) {
@@ -259,27 +256,6 @@ exports.set_message_topic = function (obj, topic) {
obj.topic = topic;
};
exports.get_message_topic = function (obj) {
// TODO: Kill off the below defensive code by the
// end of February 2020 (giving ourselves a
// little bit of time to make sure we don't
// have any obscure codepaths left that weren't
// properly handled in our subject/topic migration).
//
// Also, once we are confident that all of our
// internal objects have been migrated from
// "subject" to "topic", we can start having
// our callers just do `foo = message.topic`
// and phase out the use of this function. Or
// we can just sweep the codebase.
if (obj.topic === undefined) {
blueslip.error('programming error: message has no topic');
return obj.subject;
}
return obj.topic;
};
exports.get_edit_event_topic = function (obj) {
if (obj.topic === undefined) {
return obj.subject;