filter: Store reference to _sub instead of _stream_params.

In commit 4f6377d493 we added
`_stream_params` as a way of storing attributes such as stream name
and stream privacy, this involved adding a few calls within functions
that updated these values (in order to maintain consistency).

This commit replaces `_stream_params` with an always consistent `_sub`
object and removes unnecessary `_stream_params` related code. Once the
`_sub` object is available, calls to `stream_data` may be considered
suspicious as they can often be avoided by just picking the desired
attribute off of the `_sub` object.
This commit is contained in:
YashRE42
2020-06-15 22:27:26 +00:00
committed by Tim Abbott
parent b0b53c8543
commit 7ea60ea1ab
3 changed files with 20 additions and 54 deletions

View File

@@ -49,9 +49,8 @@ function make_tab_data(filter) {
exports.colorize_tab_bar = function () {
const filter = narrow_state.filter();
if (filter === undefined || !filter.has_operator('stream') || !filter._stream_params) {return;}
const color_for_stream = stream_data.get_color(filter._stream_params._stream_name);
$("#tab_list .stream > .fa").css('color', color_for_stream);
if (filter === undefined || !filter._sub) {return;}
$("#tab_list .stream > .fa").css('color', filter._sub.color);
};
function append_and_display_title_area(tab_bar_data) {