Merge pull request #122 from xPaw/odd-invite

Fix #116: Move 'you' handling in invites to the client
This commit is contained in:
Jérémie Astori 2016-03-01 00:16:55 -05:00
commit 325739c8be
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", {