Skip to content

Commit

Permalink
Fix for showing unread counts on connection restore.
Browse files Browse the repository at this point in the history
  • Loading branch information
ericbarch committed Aug 9, 2013
1 parent 61ba714 commit 8fb8946
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion assets/js/views/channel_tab.js
Expand Up @@ -7,6 +7,7 @@ var ChannelTabView = Backbone.View.extend({
},

initialize: function() {
this.model['initial'] = true;
this.model.stream.bind('add', this.updateUnreadCounts, this);
this.model.bind('destroy', this.switchAndRemove, this)
.bind('change:active', this.removeUnread, this);
Expand Down Expand Up @@ -34,7 +35,7 @@ var ChannelTabView = Backbone.View.extend({
var unread = this.model.get('unread');
var unreadMentions = this.model.get('unreadMentions');

if ($(this.el).hasClass('active')) return;
if ($(this.el).hasClass('active') && !this.model.initial) return;

// TODO: do something more sensible here than remove/readd elements
// this.$el.children('.unread, .unread_mentions').remove();
Expand All @@ -44,6 +45,8 @@ var ChannelTabView = Backbone.View.extend({

if (unreadMentions > 0) this.$('.unread-mentions').text(unreadMentions).show();
else this.$('.unread-mentions').hide();

this.model.initial = false;
},

removeUnread: function() {
Expand Down

0 comments on commit 8fb8946

Please sign in to comment.