@nodebb/nodebb-plugin-reactions 2.1.6 → 2.1.7

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/package.json +1 -1
  2. package/public/client.js +11 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodebb/nodebb-plugin-reactions",
3
- "version": "2.1.6",
3
+ "version": "2.1.7",
4
4
  "nbbpm": {
5
5
  "compatibility": "^3.3.0"
6
6
  },
package/public/client.js CHANGED
@@ -217,8 +217,18 @@ $(document).ready(function () {
217
217
 
218
218
  function createReactionTooltips() {
219
219
  require(['bootstrap', 'translator'], function (bootstrap, translator) {
220
+ function disposeTooltip(el) {
221
+ if (el && el.length) {
222
+ const tooltip = bootstrap.Tooltip.getInstance(el.get(0));
223
+ if (tooltip) {
224
+ tooltip.dispose();
225
+ el.attr('title', '');
226
+ }
227
+ }
228
+ }
220
229
  async function createTooltip(data) {
221
230
  const el = mouseOverReactionEl;
231
+ disposeTooltip(el);
222
232
  let usernames = data.usernames.filter(name => name !== '[[global:former_user]]');
223
233
  if (!usernames.length) {
224
234
  return;
@@ -277,12 +287,7 @@ $(document).ready(function () {
277
287
  $('#content').on('mouseleave', '.reaction', function () {
278
288
  clearTooltipTimeout();
279
289
  mouseOverReactionEl = null;
280
- const $this = $(this);
281
- const tooltip = bootstrap.Tooltip.getInstance(this);
282
- if (tooltip) {
283
- tooltip.dispose();
284
- $this.attr('title', '');
285
- }
290
+ disposeTooltip($(this));
286
291
  });
287
292
  }
288
293
  });