@nodebb/nodebb-plugin-reactions 2.2.0 → 2.2.2

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.
@@ -0,0 +1,25 @@
1
+ {
2
+ "reactions": "Reakcje",
3
+ "add-reaction": "Zareaguj",
4
+ "error.invalid-reaction": "Wadliwa reakcja",
5
+ "error.maximum-reached": "Osiągnięto limit reakcji",
6
+ "error.maximum-per-user-per-post-reached": "Osiągnięto limit reakcji przypadających na jeden wpis",
7
+ "settings.title": "Ustawienia wtyczki",
8
+ "settings.enable-post-reactions": "Włącz reakcje na wpisy",
9
+ "settings.max-reactions-per-post": "Do ilu reakcji na wpis (0 to brak limitu, domyślnie: 4)",
10
+ "settings.max-reactions-per-user-per-post": "Do ilu reakcji na wpis ma przypaść na jednego użytkownika (0 to brak limitu)",
11
+ "settings.max-reactions-per-user-per-post-help": "Limit odnosi się tylko do nowych reakcji a nie do dołączania się do już dodanych.",
12
+ "settings.enable-message-reactions": "Włącz reakcje na wiadomości",
13
+ "settings.max-reactions-per-message": "Do ilu reakcji na wiadomość (0 to brak limitu, domyślnie: 4)",
14
+ "settings.max-reactions-per-user-per-message": "Do ilu reakcji ograniczyć użytkownika reagującego na wiadomość (0 to brak limitu)",
15
+ "settings.max-reactions-per-user-per-message-help": "Limit odnosi się tylko do nowych reakcji a nie do dołączania się do już dodanych.",
16
+ "settings.reaction-reputations": "Reakcja a reputacja reakcji (opcjonalnie)",
17
+ "settings.reaction-reputations-help": "Reputacja powiązana z reakcjami. Wtedy autor wpisu zbiera reputację o ile pojawią się na niego reakcje.",
18
+ "settings.reaction-reputations.add": "Dodaj zasadę",
19
+ "settings.reaction-reputations.reaction": "Reakcja",
20
+ "settings.reaction-reputations.reputation": "Reputacja",
21
+ "settings.reaction-reputations.remove": "Skasuj",
22
+ "settings.reaction-reputations.edit": "Zmień",
23
+ "notification.user-has-reacted-with-to-your-post-in-topic": "<strong>%1</strong> zareagował %2 na wpis w <strong>%3</strong>",
24
+ "notification.user-has-reacted-with-to-your-message-in-room": "<strong>%1</strong> zareagował %2 na wiadomość w <strong class=\"text-nowrap\"><i class=\"fa %3\"></i>%4</strong>"
25
+ }
package/library.js CHANGED
@@ -119,22 +119,24 @@ ReactionsPlugin.getPostReactions = async function (data) {
119
119
  const reactionSetToUsersMap = await getReactionSetsUidsMap(reactionSets);
120
120
 
121
121
  for (const post of data.posts) {
122
- post.maxReactionsReached = pidToIsMaxReactionsReachedMap.get(post.pid);
123
- post.reactions = [];
124
-
125
- const reactions = pidToReactionsMap.get(post.pid);
126
- if (reactions) {
127
- for (const reaction of reactions) {
128
- const reactionSet = `pid:${post.pid}:reaction:${reaction}`;
129
- const uids = reactionSetToUsersMap.get(reactionSet);
130
- if (Array.isArray(uids)) {
131
- post.reactions.push({
132
- pid: post.pid,
133
- reacted: uids.includes(String(data.uid)),
134
- reaction,
135
- reactionImage: parse(reaction),
136
- reactionCount: uids.length,
137
- });
122
+ if (post) {
123
+ post.maxReactionsReached = pidToIsMaxReactionsReachedMap.get(post.pid);
124
+ post.reactions = [];
125
+
126
+ const reactions = pidToReactionsMap.get(post.pid);
127
+ if (reactions) {
128
+ for (const reaction of reactions) {
129
+ const reactionSet = `pid:${post.pid}:reaction:${reaction}`;
130
+ const uids = reactionSetToUsersMap.get(reactionSet);
131
+ if (Array.isArray(uids)) {
132
+ post.reactions.push({
133
+ pid: post.pid,
134
+ reacted: uids.includes(String(data.uid)),
135
+ reaction,
136
+ reactionImage: parse(reaction),
137
+ reactionCount: uids.length,
138
+ });
139
+ }
138
140
  }
139
141
  }
140
142
  }
@@ -179,21 +181,23 @@ ReactionsPlugin.getMessageReactions = async function (data) {
179
181
  const reactionSetToUsersMap = await getReactionSetsUidsMap(reactionSets);
180
182
 
181
183
  for (const msg of data.messages) {
182
- msg.maxReactionsReached = midToIsMaxReactionsReachedMap.get(msg.mid);
183
- msg.reactions = [];
184
- const reactions = midToReactionsMap.get(msg.mid);
185
- if (reactions) {
186
- for (const reaction of reactions) {
187
- const reactionSet = `mid:${msg.mid}:reaction:${reaction}`;
188
- const uids = reactionSetToUsersMap.get(reactionSet);
189
- if (Array.isArray(uids)) {
190
- msg.reactions.push({
191
- mid: msg.mid,
192
- reacted: uids.includes(String(data.uid)),
193
- reaction,
194
- reactionImage: parse(reaction),
195
- reactionCount: uids.length,
196
- });
184
+ if (msg) {
185
+ msg.maxReactionsReached = midToIsMaxReactionsReachedMap.get(msg.mid);
186
+ msg.reactions = [];
187
+ const reactions = midToReactionsMap.get(msg.mid);
188
+ if (reactions) {
189
+ for (const reaction of reactions) {
190
+ const reactionSet = `mid:${msg.mid}:reaction:${reaction}`;
191
+ const uids = reactionSetToUsersMap.get(reactionSet);
192
+ if (Array.isArray(uids)) {
193
+ msg.reactions.push({
194
+ mid: msg.mid,
195
+ reacted: uids.includes(String(data.uid)),
196
+ reaction,
197
+ reactionImage: parse(reaction),
198
+ reactionCount: uids.length,
199
+ });
200
+ }
197
201
  }
198
202
  }
199
203
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodebb/nodebb-plugin-reactions",
3
- "version": "2.2.0",
3
+ "version": "2.2.2",
4
4
  "nbbpm": {
5
5
  "compatibility": "^3.6.0"
6
6
  },