From a32b3a30a1b3b7e1ff37f8f60d83bfdbdbaea0f6 Mon Sep 17 00:00:00 2001 From: Darren Date: Sun, 13 Jul 2014 15:19:55 +0100 Subject: [PATCH] Only colourise nicks if in a users message, not joins/parts/etc --- client/src/views/channel.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/client/src/views/channel.js b/client/src/views/channel.js index c188ce5..d787a66 100644 --- a/client/src/views/channel.js +++ b/client/src/views/channel.js @@ -150,8 +150,8 @@ _kiwi.view.Channel = _kiwi.view.Panel.extend({ // Let nicks be clickable + colourise within messages - parseMessageNicks: function(word) { - var members, member, colour; + parseMessageNicks: function(word, colourise) { + var members, member, colour = ''; members = this.model.get('members'); if (!members) { @@ -163,10 +163,13 @@ _kiwi.view.Channel = _kiwi.view.Panel.extend({ return; } - // Use the nick from the member object so the colour matches the letter casing - colour = this.getNickColour(member.get('nick')); + if (colourise !== false) { + // Use the nick from the member object so the colour matches the letter casing + colour = this.getNickColour(member.get('nick')); + colour = 'color:' + colour; + } - return _.template('<%- nick %>', { + return _.template('<%- nick %>', { nick: word, colour: colour }); @@ -284,7 +287,7 @@ _kiwi.view.Channel = _kiwi.view.Panel.extend({ parsed_word = this.parseMessageChannels(word); if (typeof parsed_word === 'string') return parsed_word; - parsed_word = this.parseMessageNicks(word); + parsed_word = this.parseMessageNicks(word, (msg.type === 'privmsg')); if (typeof parsed_word === 'string') return parsed_word; parsed_word = _.escape(word); -- 2.25.1