mirror of https://github.com/zulip/zulip.git
stream_list: Pinned streams are never grayed out as inactive.
We have had a longtime bug where the state of pinned streams would not update properly from the greyed out/inactive state to the active state when a first message arrived to them. After some discussion, we determined that likely the right fix for this is to simply configure pinned streams to never be marked as inactive; that's more in line with the intended user experience. Fixes #8201.
This commit is contained in:
parent
807e5c7a1a
commit
1ab4eaf819
|
@ -159,6 +159,59 @@ run_test('create_sidebar_row', () => {
|
|||
assert(removed);
|
||||
});
|
||||
|
||||
run_test('pinned_streams_never_inactive', () => {
|
||||
// Ensure that pinned streams are never treated as dormant ie never given "inactive" class
|
||||
stream_data.clear_subscriptions();
|
||||
|
||||
var devel = {
|
||||
name: 'devel',
|
||||
stream_id: 100,
|
||||
color: 'blue',
|
||||
subscribed: true,
|
||||
pin_to_top: true,
|
||||
};
|
||||
global.stream_data.add_sub('devel', devel);
|
||||
|
||||
var social = {
|
||||
name: 'social',
|
||||
stream_id: 200,
|
||||
color: 'green',
|
||||
subscribed: true,
|
||||
};
|
||||
global.stream_data.add_sub('social', social);
|
||||
|
||||
// we use social and devel created in create_social_sidebar_row() and create_devel_sidebar_row()
|
||||
|
||||
// non-pinned streams can be made inactive
|
||||
var social_sidebar = $('<social sidebar row>');
|
||||
var stream_id = social.stream_id;
|
||||
var row = stream_list.stream_sidebar.get_row(stream_id);
|
||||
stream_data.is_active = return_false;
|
||||
|
||||
stream_list.build_stream_list();
|
||||
assert(social_sidebar.hasClass('inactive_stream'));
|
||||
|
||||
stream_data.is_active = return_true;
|
||||
row.update_whether_active();
|
||||
assert(!social_sidebar.hasClass('inactive_stream'));
|
||||
|
||||
stream_data.is_active = return_false;
|
||||
row.update_whether_active();
|
||||
assert(social_sidebar.hasClass('inactive_stream'));
|
||||
|
||||
// pinned streams can never be made inactive
|
||||
var devel_sidebar = $('<devel sidebar row>');
|
||||
stream_id = devel.stream_id;
|
||||
row = stream_list.stream_sidebar.get_row(stream_id);
|
||||
stream_data.is_active = return_false;
|
||||
|
||||
stream_list.build_stream_list();
|
||||
assert(!devel_sidebar.hasClass('inactive_stream'));
|
||||
|
||||
row.update_whether_active();
|
||||
assert(!devel_sidebar.hasClass('inactive_stream'));
|
||||
});
|
||||
|
||||
set_global('$', global.make_zjquery());
|
||||
|
||||
function add_row(sub) {
|
||||
|
@ -552,6 +605,7 @@ run_test('separators_only_pinned', () => {
|
|||
assert.deepEqual(appended_elems, expected_elems);
|
||||
|
||||
});
|
||||
|
||||
run_test('update_count_in_dom', () => {
|
||||
function make_elem(elem, count_selector, value_selector) {
|
||||
var count = $(count_selector);
|
||||
|
|
|
@ -231,7 +231,7 @@ function build_stream_sidebar_row(sub) {
|
|||
var list_item = build_stream_sidebar_li(sub);
|
||||
|
||||
self.update_whether_active = function () {
|
||||
if (stream_data.is_active(sub)) {
|
||||
if (stream_data.is_active(sub) || sub.pin_to_top === true) {
|
||||
list_item.removeClass('inactive_stream');
|
||||
} else {
|
||||
list_item.addClass('inactive_stream');
|
||||
|
|
Loading…
Reference in New Issue