compose_fade: Change would_receive_message to use user_id.

This commit changes the would_receive_message to use user_id
instead of emails.

This change is done because user_ids are immutable and using
user_ids is the correct way of uniquely identifying user.

The change in 'would_receive_message' also leads to change
in util.is_pm_recipient to use a string of user_ids instead
of emails.

We also know that user_ids passed to 'would_receive_message'
are active user_ids, since we get them from buddy_list.
So we don't need to check whether the user is active, which
was previously being checked by get_active_user_for_email.
This commit is contained in:
sahil839
2020-06-05 23:19:16 +05:30
committed by Tim Abbott
parent 25aed90da1
commit 40475a41b0
4 changed files with 16 additions and 19 deletions

View File

@@ -62,9 +62,9 @@ exports.same_stream_and_topic = function util_same_stream_and_topic(a, b) {
lower_same(a.topic, b.topic);
};
exports.is_pm_recipient = function (email, message) {
const recipients = message.reply_to.toLowerCase().split(',');
return recipients.includes(email.toLowerCase());
exports.is_pm_recipient = function (user_id, message) {
const recipients = message.to_user_ids.split(',');
return recipients.includes(user_id.toString());
};
exports.extract_pm_recipients = function (recipients) {