Keep track of highlights when user is offline

This commit is contained in:
Pavel Djundik 2016-03-13 18:05:05 +02:00
parent f81235900b
commit 96ef274838
4 changed files with 7 additions and 1 deletions

View file

@ -1,6 +1,6 @@
{{#each channels}}
<div data-id="{{id}}" data-target="#chan-{{id}}" data-title="{{name}}" class="chan {{type}}">
<span class="badge" data-count="{{unread}}">{{#if unread}}{{unread}}{{/if}}</span>
<span class="badge{{#if highlight}} highlight{{/if}}" data-count="{{unread}}">{{#if unread}}{{unread}}{{/if}}</span>
<span class="close"></span>
<span class="name" title="{{name}}">{{name}}</span>
</div>

View file

@ -320,6 +320,7 @@ Client.prototype.open = function(data) {
var target = this.find(data);
if (target) {
target.chan.unread = 0;
target.chan.highlight = false;
this.activeChannel = target.chan.id;
}
};

View file

@ -18,6 +18,7 @@ function Chan(attr) {
topic: "",
type: Chan.Type.CHANNEL,
unread: 0,
highlight: false,
users: []
}, attr));
}

View file

@ -46,6 +46,10 @@ module.exports = function(irc, network) {
if (chan.id !== client.activeChannel) {
chan.unread++;
if (highlight) {
chan.highlight = true;
}
}
var name = data.from;