Fix unread counts display when pinning/un-pinning.

The fix works by having build_stream_sidebar_row()
automatically update its own unread count when we
build a sidebar row.  Currently we rebuild sidebar
rows when we pin/unpin rows.

As an aside, we currently don't really need to rebuild
the sidebar row when we pin, since we're only moving
the DOM, not altering it.  But this may change in the
future, so I decided to leave that code path in place.
We may decide to do things in the future like showing
pinned streams with bolder fonts or special icons or
whatever.

Fixes #2902
This commit is contained in:
Steve Howell
2017-01-15 08:09:16 -08:00
committed by Tim Abbott
parent 9616d91bdd
commit c36932d29e
2 changed files with 12 additions and 0 deletions

View File

@@ -273,6 +273,14 @@ function build_stream_sidebar_row(sub) {
list_item.remove();
};
self.update_unread_count = function () {
var count = unread.num_unread_for_stream(stream_name);
update_count_in_dom(list_item, count);
};
self.update_unread_count();
exports.stream_sidebar.set_row(sub.stream_id, self);
}