diff --git a/app/javascript/flavours/glitch/util/emoji/index.js b/app/javascript/flavours/glitch/util/emoji/index.js
index 22b657b05b..61f211c92b 100644
--- a/app/javascript/flavours/glitch/util/emoji/index.js
+++ b/app/javascript/flavours/glitch/util/emoji/index.js
@@ -6,13 +6,18 @@ const trie = new Trie(Object.keys(unicodeMapping));
const assetHost = process.env.CDN_HOST || '';
-// Emoji requiring extra borders depending on theme
-const darkEmoji = 'đąđâĢđ¤âŦâŧī¸âžâŧī¸âī¸âĒī¸đŖđŗđˇđ¸âŖī¸đļī¸â´ī¸đđââī¸đŊī¸đŗđĻđđĒđŗī¸đšī¸đđī¸đī¸đââī¸đ¤đđĨđŧâ ī¸đŠđĻđŧđšđŽđđ´';
-const lightEmoji = 'đŊâžđâī¸đ¨đī¸đđĨđģđâââ¸ī¸đŠī¸đđđđ§ī¸đđđđđđâ ī¸đ¨ī¸đđđŦđđđŗī¸âĒâŦâŊâģī¸âĢī¸';
+// Convert to file names from emojis. (For different variation selector emojis)
+const emojiFilenames = (emojis) => {
+ return emojis.map(v => unicodeMapping[v].filename);
+};
-const emojiFilename = (filename, match) => {
+// Emoji requiring extra borders depending on theme
+const darkEmoji = emojiFilenames(['đą', 'đ', 'âĢ', 'đ¤', 'âŦ', 'âŧī¸', 'âž', 'âŧī¸', 'âī¸', 'âĒī¸', 'đŖ', 'đŗ', 'đˇ', 'đ¸', 'âŖī¸', 'đļī¸', 'â´ī¸', 'đ', 'đââī¸', 'đŊī¸', 'đŗ', 'đĻ', 'đ', 'đĒ', 'đŗī¸', 'đšī¸', 'đ', 'đī¸', 'đī¸', 'đââī¸', 'đ¤', 'đ', 'đĨ', 'đŧ', 'â ī¸', 'đŠ', 'đĻ', 'đŧ', 'đš', 'đŽ', 'đ', 'đ´']);
+const lightEmoji = emojiFilenames(['đŊ', 'âž', 'đ', 'âī¸', 'đ¨', 'đī¸', 'đ', 'đĨ', 'đģ', 'đ', 'â', 'â', 'â¸ī¸', 'đŠī¸', 'đ', 'đ', 'đ', 'đ§ī¸', 'đ', 'đ', 'đ', 'đ', 'đ', 'đ', 'â ī¸', 'đ¨ī¸', 'đ', 'đ', 'đŦ', 'đ', 'đ', 'đŗī¸', 'âĒ', 'âŦ', 'âŊ', 'âģī¸', 'âĢī¸']);
+
+const emojiFilename = (filename) => {
const borderedEmoji = (document.body && document.body.classList.contains('skin-mastodon-light')) ? lightEmoji : darkEmoji;
- return borderedEmoji.includes(match) ? (filename + '_border') : filename;
+ return borderedEmoji.includes(filename) ? (filename + '_border') : filename;
};
const emojify = (str, customEmojis = {}) => {
@@ -69,7 +74,7 @@ const emojify = (str, customEmojis = {}) => {
} else if (!useSystemEmojiFont) { // matched to unicode emoji
const { filename, shortCode } = unicodeMapping[match];
const title = shortCode ? `:${shortCode}:` : '';
- replacement = ``;
+ replacement = ``;
rend = i + match.length;
// If the matched character was followed by VS15 (for selecting text presentation), skip it.
if (str.codePointAt(rend) === 65038) {