Fix how we find if streams are muted.

This commit changes stream_data.in_home_view() to
take a stream_id parameter, which will make it more
robust to stream name changes.

This fixes a bug.  Now when an admin renames a stream
you are looking at, it will correctly show itself to
be un-muted. (Even with this fix, though, the stream
appears to be inactive.)

Some callers still do lookups by name, and they will
call name_in_home_view() for now, which we can
hopefully deprecate over time.
This commit is contained in:
Steve Howell
2017-05-13 11:54:53 -07:00
committed by Tim Abbott
parent d3a7aa3a37
commit c125ba1d08
10 changed files with 47 additions and 15 deletions

View File

@@ -417,7 +417,7 @@ function message_is_notifiable(message) {
return true;
}
if ((message.type === "stream") &&
!stream_data.in_home_view(message.stream)) {
!stream_data.in_home_view(message.stream_id)) {
return false;
}
if ((message.type === "stream") &&
@@ -548,7 +548,7 @@ exports.possibly_notify_new_messages_outside_viewport = function (messages, loca
if (row.length === 0) {
if (message.type === "stream" && muting.is_topic_muted(message.stream, message.subject)) {
note = "Sent! Your message was sent to a topic you have muted.";
} else if (message.type === "stream" && !stream_data.in_home_view(message.stream)) {
} else if (message.type === "stream" && !stream_data.in_home_view(message.stream_id)) {
note = "Sent! Your message was sent to a stream you have muted.";
} else {
// offscreen because it is outside narrow