diff --git a/static/js/compose_fade.js b/static/js/compose_fade.js index 5f1377b883..a9cc6912af 100644 --- a/static/js/compose_fade.js +++ b/static/js/compose_fade.js @@ -121,8 +121,7 @@ exports.would_receive_message = function (email) { } // PM, so check if the given email is in the recipients list. - var recipients = focused_recipient.reply_to.toLowerCase().split(','); - return recipients.indexOf(email.toLowerCase()) !== -1; + return util.is_pm_recipient(email, focused_recipient); }; function _fade_users() { diff --git a/static/js/util.js b/static/js/util.js index 8b515dad1c..473aaf8fcb 100644 --- a/static/js/util.js +++ b/static/js/util.js @@ -65,6 +65,11 @@ exports.is_current_user = function (email) { return email.toLowerCase() === page_params.email.toLowerCase(); }; +exports.is_pm_recipient = function (email, message) { + var recipients = message.reply_to.toLowerCase().split(','); + return recipients.indexOf(email.toLowerCase()) !== -1; +}; + exports.same_major_recipient = function (a, b) { // Same behavior as same_recipient, except that it returns true for messages // on different topics but the same stream.