echo: Support senders other than ourself in display_recipient logic.

we don't have a current use case for this feature, but it better
matches what we mean and thus makes the function more readable.
This commit is contained in:
Tim Abbott
2020-01-31 12:46:03 -08:00
parent d7107f47cd
commit 992b15b86c

View File

@@ -50,7 +50,7 @@ exports.build_display_recipient = function (message) {
// ", " at the end of the recipient list
const emails = util.extract_pm_recipients(message.private_message_recipient);
let me_in_display_recipients = false;
let sender_in_display_recipients = false;
const display_recipient = _.map(emails, function (email) {
email = email.trim();
const person = people.get_by_email(email);
@@ -73,8 +73,8 @@ exports.build_display_recipient = function (message) {
};
}
if (people.is_my_user_id(person.user_id)) {
me_in_display_recipients = true;
if (person.user_id === message.sender_id) {
sender_in_display_recipients = true;
}
// NORMAL PATH
@@ -90,7 +90,7 @@ exports.build_display_recipient = function (message) {
};
});
if (!me_in_display_recipients) {
if (!sender_in_display_recipients) {
// Ensure that the current user is included in
// display_recipient for group PMs.
display_recipient.push({