When fading tests for matching messages, normalize huddle lists

(imported from commit 805e62c1a57e754c225b743c7d801d8b33da5ed4)
This commit is contained in:
Kevin Mehall
2013-06-17 14:31:31 -04:00
parent b1b4c1a625
commit dc6dd71658
2 changed files with 8 additions and 1 deletions

View File

@@ -193,6 +193,13 @@ exports.same_sender = function util_same_sender(a, b) {
(a.sender_email === b.sender_email));
};
exports.normalize_recipients = function (recipients) {
recipients = $.map(recipients.split(','), $.trim);
recipients = $.grep(recipients, function (s) { return s.length>0; });
recipients.sort();
return recipients.join(',');
};
// Avoid URI decode errors by removing characters from the end
// one by one until the decode succeeds. This makes sense if
// we are decoding input that the user is in the middle of