diff --git a/zephyr/static/js/compose.js b/zephyr/static/js/compose.js index b955d539a9..9c7360ec1e 100644 --- a/zephyr/static/js/compose.js +++ b/zephyr/static/js/compose.js @@ -157,7 +157,7 @@ function update_fade () { faded_to.stream = $('#stream').val(); faded_to.subject = $('#subject').val(); } else { - faded_to.reply_to = $('#private_message_recipient').val(); + faded_to.reply_to = util.normalize_recipients($('#private_message_recipient').val()); } compose.update_faded_messages(); diff --git a/zephyr/static/js/util.js b/zephyr/static/js/util.js index cab8d3934b..cf5087c167 100644 --- a/zephyr/static/js/util.js +++ b/zephyr/static/js/util.js @@ -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