From e4c6d78762c8a9aa3fa80b930b3d2a0e2d4397e4 Mon Sep 17 00:00:00 2001 From: dgw Date: Wed, 13 Sep 2017 13:43:45 -0500 Subject: [PATCH] Display correct kick modes Defining both the kicker and the target before any code touches the channel user list ensures that everything is passed to the template. --- client/views/actions/kick.tpl | 4 ++-- src/plugins/irc-events/kick.js | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/client/views/actions/kick.tpl b/client/views/actions/kick.tpl index 425a62b8..d739f4c9 100644 --- a/client/views/actions/kick.tpl +++ b/client/views/actions/kick.tpl @@ -1,6 +1,6 @@ -{{> ../user_name nick=from}} +{{> ../user_name nick=from.nick mode=from.mode}} has kicked -{{> ../user_name nick=target mode=""}} +{{> ../user_name nick=target.nick mode=target.mode}} {{#if text}} ({{{parse text}}}) {{/if}} diff --git a/src/plugins/irc-events/kick.js b/src/plugins/irc-events/kick.js index 6b3174e6..2a15fa8a 100644 --- a/src/plugins/irc-events/kick.js +++ b/src/plugins/irc-events/kick.js @@ -11,12 +11,13 @@ module.exports = function(irc, network) { return; } - const user = chan.findUser(data.kicked); + const kicker = chan.findUser(data.nick); + const target = chan.findUser(data.kicked); if (data.kicked === irc.user.nick) { chan.users = []; } else { - chan.users = _.without(chan.users, user); + chan.users = _.without(chan.users, target); } client.emit("users", { @@ -26,9 +27,8 @@ module.exports = function(irc, network) { var msg = new Msg({ type: Msg.Type.KICK, time: data.time, - mode: user.mode, - from: data.nick, - target: data.kicked, + from: kicker, + target: target, text: data.message || "", highlight: data.kicked === irc.user.nick, self: data.nick === irc.user.nick