From 59f4d7594e0cfa37cce625604b9d71ed3c0e4743 Mon Sep 17 00:00:00 2001 From: Martin Ek Date: Sun, 12 Mar 2017 19:45:01 -0400 Subject: [PATCH] Revert "Merge pull request #193 from Sanqui/avoid-highlights" This reverts commit ebe340b7cbb2ce0165755bdd7468b62d0d403fd4, reversing changes made to 0f48dfebe8453ca41f9198d067e907188d7c4216. --- lib/bot.js | 7 +------ test/bot.test.js | 16 +++++++--------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/lib/bot.js b/lib/bot.js index d666cf6f..c943d674 100644 --- a/lib/bot.js +++ b/lib/bot.js @@ -162,14 +162,9 @@ class Bot { const nickname = Bot.getDiscordNicknameOnServer(author, fromGuild); let text = this.parseText(message); let displayUsername = nickname; - - // Join the display name with double "bold" formatting characters - // to prevent unintentional highlights on the IRC side - displayUsername = displayUsername.split('').join('\u200d'); - if (this.ircNickColor) { const colorIndex = (nickname.charCodeAt(0) + nickname.length) % NICK_COLORS.length; - displayUsername = irc.colors.wrap(NICK_COLORS[colorIndex], displayUsername); + displayUsername = irc.colors.wrap(NICK_COLORS[colorIndex], nickname); } if (this.isCommandMessage(text)) { diff --git a/test/bot.test.js b/test/bot.test.js index 45e0c680..4162b7c1 100644 --- a/test/bot.test.js +++ b/test/bot.test.js @@ -10,8 +10,6 @@ import createDiscordStub from './stubs/discord-stub'; import ClientStub from './stubs/irc-client-stub'; import config from './fixtures/single-test-config.json'; -const escapeUsername = username => username.split('').join('\u200d'); - chai.should(); chai.use(sinonChai); @@ -100,7 +98,7 @@ describe('Bot', function () { }; bot.sendToIRC(message); - const expected = `<${escapeUsername(message.author.username)}> ${text}`; + const expected = `<${message.author.username}> ${text}`; ClientStub.prototype.say.should.have.been.calledWith('#irc', expected); }); @@ -122,7 +120,7 @@ describe('Bot', function () { this.bot.sendToIRC(message); // Wrap in colors: - const expected = `<\u000304${escapeUsername(message.author.username)}\u000f> ${text}`; + const expected = `<\u000304${message.author.username}\u000f> ${text}`; ClientStub.prototype.say.should.have.been.calledWith('#irc', expected); }); @@ -144,7 +142,7 @@ describe('Bot', function () { }; this.bot.sendToIRC(message); - const expected = `<\u000304${escapeUsername(message.author.username)}\u000f> ${attachmentUrl}`; + const expected = `<\u000304${message.author.username}\u000f> ${attachmentUrl}`; ClientStub.prototype.say.should.have.been.calledWith('#irc', expected); }); @@ -169,9 +167,9 @@ describe('Bot', function () { this.bot.sendToIRC(message); ClientStub.prototype.say.should.have.been.calledWith('#irc', - `<\u000304${escapeUsername(message.author.username)}\u000f> ${text}`); + `<\u000304${message.author.username}\u000f> ${text}`); - const expected = `<\u000304${escapeUsername(message.author.username)}\u000f> ${attachmentUrl}`; + const expected = `<\u000304${message.author.username}\u000f> ${attachmentUrl}`; ClientStub.prototype.say.should.have.been.calledWith('#irc', expected); }); @@ -245,7 +243,7 @@ describe('Bot', function () { }; // Wrap it in colors: - const expected = `<\u000312${escapeUsername(message.author.username)}\u000f> #${message.channel.name}`; + const expected = `<\u000312${message.author.username}\u000f> #${message.channel.name}`; this.bot.sendToIRC(message); ClientStub.prototype.say .should.have.been.calledWith('#irc', expected); @@ -384,7 +382,7 @@ describe('Bot', function () { }; bot.sendToIRC(message); - const expected = `<${escapeUsername(nickname)}> ${text}`; + const expected = `<${nickname}> ${text}`; ClientStub.prototype.say.should.have.been.calledWith('#irc', expected); });