Fix #116: Move 'you' handling in invites to the client

This commit is contained in:
Pavel Djundik 2016-02-28 10:21:19 +02:00
parent f8eb50260f
commit f6563d0ea9
2 changed files with 7 additions and 5 deletions

View file

@ -1,5 +1,9 @@
<a href="#" class="user">{{from}}</a>
invited
<a href="#" class="user">{{target}}</a>
{{#if invitedYou}}
you
{{else}}
<a href="#" class="user">{{target}}</a>
{{/if}}
to
{{{parse text}}}

View file

@ -5,9 +5,6 @@ module.exports = function(irc, network) {
var client = this;
irc.on("invite", function(data) {
var target = data.to;
if (target.toLowerCase() === irc.me.toLowerCase()) {
target = "you";
}
var chan = _.find(network.channels, {name: data.channel});
if (typeof chan === "undefined") {
@ -18,7 +15,8 @@ module.exports = function(irc, network) {
type: Msg.Type.INVITE,
from: data.from,
target: target,
text: data.channel
text: data.channel,
invitedYou: target.toLowerCase() === irc.me.toLowerCase()
});
chan.messages.push(msg);
client.emit("msg", {