nodebb-plugin-poll 4.0.7 → 4.0.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-poll",
3
- "version": "4.0.7",
3
+ "version": "4.0.8",
4
4
  "description": "NodeBB Poll Plugin",
5
5
  "main": "library.js",
6
6
  "scripts": {
@@ -26,7 +26,7 @@
26
26
  "cron": "^1.8.2"
27
27
  },
28
28
  "nbbpm": {
29
- "compatibility": "^4.9.2"
29
+ "compatibility": "^4.12.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "eslint": "10.0.3",
@@ -13,8 +13,8 @@
13
13
  formatting.addButtonDispatch('poll', function (/* textarea */) {
14
14
  onPollButtonClicked(composer);
15
15
  });
16
-
17
- updateComposerBadgeCount(postContainer, postData.polls ? postData.polls.length : 0);
16
+ const uuid = postContainer.attr('data-uuid');
17
+ updateComposerBadgeCount(uuid, postData.polls ? postData.polls.length : 0);
18
18
  }
19
19
  });
20
20
  }
@@ -69,8 +69,8 @@
69
69
  postData.polls.push(newPoll);
70
70
  }
71
71
  openManageModal({ ...payload, modal });
72
- const postContainer = $(`[component="composer"][data-uuid="${uuid}"]`);
73
- updateComposerBadgeCount(postContainer, postData.polls.length);
72
+
73
+ updateComposerBadgeCount(uuid, postData.polls.length);
74
74
  });
75
75
  return false;
76
76
  },
@@ -100,8 +100,7 @@
100
100
  if (poll) {
101
101
  postData.polls = postData.polls.filter(poll => String(poll.pollId) !== clickedPollId);
102
102
  openManageModal(payload);
103
- const postContainer = $(`[component="composer"][data-uuid="${uuid}"]`);
104
- updateComposerBadgeCount(postContainer, postData.polls.length);
103
+ updateComposerBadgeCount(uuid, postData.polls.length);
105
104
  }
106
105
  });
107
106
  });
@@ -270,13 +269,11 @@
270
269
  });
271
270
  }
272
271
 
273
- function updateComposerBadgeCount(postContainer, count) {
274
- require(['composer'], (composer) => {
275
- composer.updateFormattingBtnBadgeCount(
276
- postContainer,
277
- 'poll',
278
- count
279
- );
272
+ function updateComposerBadgeCount(uuid, count) {
273
+ $(window).trigger('action:composer.updateFormattingBtnBadgeCount', {
274
+ uuid: uuid,
275
+ formatName: 'poll',
276
+ count,
280
277
  });
281
278
  }
282
279