@nodebb/nodebb-plugin-reactions 2.2.9 → 2.2.10

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 CHANGED
@@ -560,7 +560,7 @@ SocketPlugins.reactions = {
560
560
  if (!nameToEmoji(data.reaction)) {
561
561
  throw new Error('[[reactions:error.invalid-reaction]]');
562
562
  }
563
- let set = '';
563
+ let set;
564
564
  if (data.type === 'post') {
565
565
  if (!await privileges.posts.can('topics:read', data.pid, socket.uid)) {
566
566
  throw new Error('[[error:not-allowed]]');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodebb/nodebb-plugin-reactions",
3
- "version": "2.2.9",
3
+ "version": "2.2.10",
4
4
  "nbbpm": {
5
5
  "compatibility": "^3.6.0 || ^4.0.0"
6
6
  },
@@ -38,8 +38,8 @@
38
38
  },
39
39
  "license": "MIT",
40
40
  "devDependencies": {
41
- "eslint": "9.28.0",
42
- "eslint-config-nodebb": "1.1.7"
41
+ "eslint": "10.0.2",
42
+ "eslint-config-nodebb": "^2.0.0"
43
43
  },
44
44
  "scripts": {
45
45
  "lint": "eslint ."
package/public/admin.js CHANGED
@@ -3,7 +3,7 @@
3
3
  define('admin/plugins/reactions', [
4
4
  'settings', 'alerts', 'hooks', 'emoji-dialog', 'emoji',
5
5
  ], function (Settings, alerts, hooks, emojiDialog, emoji) {
6
- var ACP = {};
6
+ const ACP = {};
7
7
  ACP.init = function () {
8
8
  emoji.init(function () {
9
9
  Settings.load('reactions', $('.reactions-settings'), onSettingsLoaded);
package/public/client.js CHANGED
@@ -18,7 +18,7 @@ $(document).ready(function () {
18
18
  hooks.on('action:chat.loaded', function (container) {
19
19
  if (ajaxify.data.template.chats && ajaxify.data.roomId) {
20
20
  setupMessageReactions(container);
21
- } else if (container.hasClass('chat-modal')) {
21
+ } else if (container.hasClass('chat-modal') || container.attr('component') === 'chat/widget') {
22
22
  setupMessageReactions(container);
23
23
  }
24
24
  });
@@ -45,11 +45,11 @@ $(document).ready(function () {
45
45
  setupPostReactionSockets();
46
46
 
47
47
  $('[component="topic"]').on('click', '[component="post/reaction"]', function () {
48
- var reactionElement = $(this);
49
- var pid = reactionElement.attr('data-pid');
50
- var reaction = reactionElement.attr('data-reaction');
51
- var reacted = reactionElement.hasClass('reacted');
52
- var event = 'plugins.reactions.' + (reacted ? 'removePostReaction' : 'addPostReaction');
48
+ const reactionElement = $(this);
49
+ const pid = reactionElement.attr('data-pid');
50
+ const reaction = reactionElement.attr('data-reaction');
51
+ const reacted = reactionElement.hasClass('reacted');
52
+ const event = 'plugins.reactions.' + (reacted ? 'removePostReaction' : 'addPostReaction');
53
53
  socket.emit(event, {
54
54
  pid: pid,
55
55
  reaction: reaction,
@@ -61,8 +61,8 @@ $(document).ready(function () {
61
61
  });
62
62
 
63
63
  $('[component="topic"]').on('click', '[component="post/reaction/add"]', function () {
64
- var reactionAddEl = $(this);
65
- var pid = reactionAddEl.attr('data-pid');
64
+ const reactionAddEl = $(this);
65
+ const pid = reactionAddEl.attr('data-pid');
66
66
  require(['emoji-dialog'], function (emojiDialog) {
67
67
  emojiDialog.toggle(reactionAddEl[0], function (_, name, dialog) {
68
68
  emojiDialog.dialogActions.close(dialog);
@@ -88,11 +88,11 @@ $(document).ready(function () {
88
88
 
89
89
  const messageContent = container.find('[component="chat/message/content"]');
90
90
  messageContent.on('click', '[component="message/reaction"]', function () {
91
- var reactionElement = $(this);
92
- var mid = reactionElement.attr('data-mid');
93
- var reaction = reactionElement.attr('data-reaction');
94
- var reacted = reactionElement.hasClass('reacted');
95
- var event = 'plugins.reactions.' + (reacted ? 'removeMessageReaction' : 'addMessageReaction');
91
+ const reactionElement = $(this);
92
+ const mid = reactionElement.attr('data-mid');
93
+ const reaction = reactionElement.attr('data-reaction');
94
+ const reacted = reactionElement.hasClass('reacted');
95
+ const event = 'plugins.reactions.' + (reacted ? 'removeMessageReaction' : 'addMessageReaction');
96
96
  socket.emit(event, {
97
97
  mid: mid,
98
98
  reaction: reaction,
@@ -147,10 +147,10 @@ $(document).ready(function () {
147
147
  }
148
148
 
149
149
  function updatePostReactionCount(data, type) {
150
- var maxReactionsReached = parseInt(data.totalReactions, 10) > config.maximumReactions;
150
+ const maxReactionsReached = parseInt(data.totalReactions, 10) > config.maximumReactions;
151
151
  $('[component="post/reaction/add"][data-pid="' + data.pid + '"]').toggleClass('max-reactions', maxReactionsReached);
152
152
 
153
- var reactionEl = $(`[component="post/reaction"][data-pid="${data.pid}"][data-reaction="${data.reaction}"]`);
153
+ const reactionEl = $(`[component="post/reaction"][data-pid="${data.pid}"][data-reaction="${data.reaction}"]`);
154
154
 
155
155
  if (parseInt(data.reactionCount, 10) === 0) {
156
156
  reactionEl.tooltip('dispose');
@@ -179,10 +179,10 @@ $(document).ready(function () {
179
179
  }
180
180
 
181
181
  function updateMessageReactionCount(data, type) {
182
- var maxReactionsReached = parseInt(data.totalReactions, 10) > config.maximumReactionsPerMessage;
182
+ const maxReactionsReached = parseInt(data.totalReactions, 10) > config.maximumReactionsPerMessage;
183
183
  $('[component="message/reaction/add"][data-mid="' + data.mid + '"]').toggleClass('max-reactions', maxReactionsReached);
184
184
 
185
- var reactionEl = $(`[component="message/reaction"][data-mid="${data.mid}"][data-reaction="${data.reaction}"]`);
185
+ const reactionEl = $(`[component="message/reaction"][data-mid="${data.mid}"][data-reaction="${data.reaction}"]`);
186
186
 
187
187
  if (parseInt(data.reactionCount, 10) === 0) {
188
188
  reactionEl.tooltip('dispose');