From f6563d0ea94267b7529ab9559e577f86606ef55d Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Sun, 28 Feb 2016 10:21:19 +0200 Subject: [PATCH] Fix #116: Move 'you' handling in invites to the client --- client/views/actions/invite.tpl | 6 +++++- src/plugins/irc-events/invite.js | 6 ++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/client/views/actions/invite.tpl b/client/views/actions/invite.tpl index 52f2c0a9..1f3a7750 100644 --- a/client/views/actions/invite.tpl +++ b/client/views/actions/invite.tpl @@ -1,5 +1,9 @@ {{from}} invited -{{target}} +{{#if invitedYou}} + you +{{else}} + {{target}} +{{/if}} to {{{parse text}}} diff --git a/src/plugins/irc-events/invite.js b/src/plugins/irc-events/invite.js index 3ff3ac5b..6bf1e3b7 100644 --- a/src/plugins/irc-events/invite.js +++ b/src/plugins/irc-events/invite.js @@ -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", {