util: Compare recipient streams by name, not recipient id.

This is more consistent with how we compare subjects etc., and can be
used for comparing the subjects of a potential future message that
doesn't have a recipient id yet.

(imported from commit 93251c62dc74b3f12c6140b12fc8d6c756d35f37)
This commit is contained in:
Tim Abbott 2013-04-08 11:58:29 -04:00
parent 3c993db1cd
commit 6e00c9ca3d
2 changed files with 3 additions and 4 deletions

View File

@ -143,7 +143,7 @@ function do_fade(reply_message, fade_type) {
type: fade_type
};
if (fade_type === "stream") {
faded_to.recipient_id = reply_message.recipient_id;
faded_to.display_recipient = reply_message.display_recipient;
faded_to.subject = reply_message.subject;
} else {
faded_to.reply_to = reply_message.reply_to;

View File

@ -166,9 +166,8 @@ exports.lower_bound = function (array, arg1, arg2, arg3, arg4) {
};
exports.same_stream_and_subject = function util_same_stream_and_subject(a, b) {
// Streams and subjects are case-insensitive. Streams have
// already been forced to the canonical case.
return ((a.recipient_id === b.recipient_id) &&
// Streams and subjects are case-insensitive.
return ((a.display_recipient.toLowerCase() === b.display_recipient.toLowerCase()) &&
(a.subject.toLowerCase() === b.subject.toLowerCase()));
};