@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.
Files changed (2) hide show
  1. package/library.js +8 -6
  2. 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(nameToEmoji(name) || emojiTable[emojiAliases[name]], '');
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
- if (Array.isArray(uids)) {
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: parse(reaction),
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
- if (Array.isArray(uids)) {
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: parse(reaction),
199
+ reactionImage: reactionImage,
198
200
  reactionCount: uids.length,
199
201
  });
200
202
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodebb/nodebb-plugin-reactions",
3
- "version": "2.2.2",
3
+ "version": "2.2.3",
4
4
  "nbbpm": {
5
5
  "compatibility": "^3.6.0"
6
6
  },