@nodebb/nodebb-plugin-reactions 2.2.2 → 2.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/library.js +8 -6
- package/package.json +1 -1
package/library.js
CHANGED
|
@@ -31,8 +31,8 @@ function parse(name) {
|
|
|
31
31
|
if (!emojiAliases) {
|
|
32
32
|
emojiAliases = require.main.require('nodebb-plugin-emoji/build/emoji/aliases.json');
|
|
33
33
|
}
|
|
34
|
-
|
|
35
|
-
return emojiParser.buildEmoji(
|
|
34
|
+
const emoji = nameToEmoji(name) || emojiTable[emojiAliases[name]];
|
|
35
|
+
return emoji ? emojiParser.buildEmoji(emoji, '') : '';
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
const ReactionsPlugin = module.exports;
|
|
@@ -128,12 +128,13 @@ ReactionsPlugin.getPostReactions = async function (data) {
|
|
|
128
128
|
for (const reaction of reactions) {
|
|
129
129
|
const reactionSet = `pid:${post.pid}:reaction:${reaction}`;
|
|
130
130
|
const uids = reactionSetToUsersMap.get(reactionSet);
|
|
131
|
-
|
|
131
|
+
const reactionImage = parse(reaction);
|
|
132
|
+
if (Array.isArray(uids) && reactionImage) {
|
|
132
133
|
post.reactions.push({
|
|
133
134
|
pid: post.pid,
|
|
134
135
|
reacted: uids.includes(String(data.uid)),
|
|
135
136
|
reaction,
|
|
136
|
-
reactionImage:
|
|
137
|
+
reactionImage: reactionImage,
|
|
137
138
|
reactionCount: uids.length,
|
|
138
139
|
});
|
|
139
140
|
}
|
|
@@ -189,12 +190,13 @@ ReactionsPlugin.getMessageReactions = async function (data) {
|
|
|
189
190
|
for (const reaction of reactions) {
|
|
190
191
|
const reactionSet = `mid:${msg.mid}:reaction:${reaction}`;
|
|
191
192
|
const uids = reactionSetToUsersMap.get(reactionSet);
|
|
192
|
-
|
|
193
|
+
const reactionImage = parse(reaction);
|
|
194
|
+
if (Array.isArray(uids) && reactionImage) {
|
|
193
195
|
msg.reactions.push({
|
|
194
196
|
mid: msg.mid,
|
|
195
197
|
reacted: uids.includes(String(data.uid)),
|
|
196
198
|
reaction,
|
|
197
|
-
reactionImage:
|
|
199
|
+
reactionImage: reactionImage,
|
|
198
200
|
reactionCount: uids.length,
|
|
199
201
|
});
|
|
200
202
|
}
|