Use stream_id in recipient comparisons.

Using stream_id in recipient comparisons fixes a
bug in this scenario: go to home view, send message
to stream, wait for admin to rename stream, send
another message to the stream.  Before this change,
the stream name would live-update but you'd get a
spurious recipient bar due to the prior message still
having the old stream name in places internally.

There were other ways to fix the live-update glitch,
but it's just generally cleaner to do stream id
comparisons.

Part of this change is to add stream_id to
compose_fade.set_focused_recipient().
This commit is contained in:
Steve Howell
2017-02-22 18:53:02 -08:00
committed by Tim Abbott
parent c02cf5dd5c
commit 4d0d18ba14
4 changed files with 14 additions and 9 deletions

View File

@@ -21,8 +21,13 @@ exports.set_focused_recipient = function (msg_type) {
};
if (focused_recipient.type === "stream") {
focused_recipient.stream = $('#stream').val();
var stream_name = $('#stream').val();
focused_recipient.subject = $('#subject').val();
focused_recipient.stream = stream_name;
var sub = stream_data.get_sub(stream_name);
if (sub) {
focused_recipient.stream_id = sub.stream_id;
}
} else {
// Normalize the recipient list so it matches the one used when
// adding the message (see message_store.add_message_metadata()).