Merge pull request #190 from thelounge/xpaw/offline-highlight

Keep track of highlights when user is offline
This commit is contained in:
Max-P 2016-03-14 20:23:00 -04:00
commit 862b5125a1
4 changed files with 7 additions and 1 deletions

View File

@ -1,6 +1,6 @@
{{#each channels}} {{#each channels}}
<div data-id="{{id}}" data-target="#chan-{{id}}" data-title="{{name}}" class="chan {{type}}"> <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="close"></span>
<span class="name" title="{{name}}">{{name}}</span> <span class="name" title="{{name}}">{{name}}</span>
</div> </div>

View File

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

View File

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

View File

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