@nodebb/nodebb-plugin-reactions 3.0.0 → 3.0.1

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
@@ -1,19 +1,19 @@
1
1
  'use strict';
2
2
 
3
- const meta = require.main.require('./src/meta');
4
- const user = require.main.require('./src/user');
5
- const posts = require.main.require('./src/posts');
6
- const topics = require.main.require('./src/topics');
7
- const messaging = require.main.require('./src/messaging');
8
- const privileges = require.main.require('./src/privileges');
9
- const db = require.main.require('./src/database');
10
- const translator = require.main.require('./src/translator');
11
- const notifications = require.main.require('./src/notifications');
12
- const routesHelpers = require.main.require('./src/routes/helpers');
13
- const websockets = require.main.require('./src/socket.io/index');
14
- const SocketPlugins = require.main.require('./src/socket.io/plugins');
15
-
16
- const emojiParser = require.main.require('nodebb-plugin-emoji/build/lib/parse.js');
3
+ const meta = nodebb.require('./src/meta');
4
+ const user = nodebb.require('./src/user');
5
+ const posts = nodebb.require('./src/posts');
6
+ const topics = nodebb.require('./src/topics');
7
+ const messaging = nodebb.require('./src/messaging');
8
+ const privileges = nodebb.require('./src/privileges');
9
+ const db = nodebb.require('./src/database');
10
+ const translator = nodebb.require('./src/translator');
11
+ const notifications = nodebb.require('./src/notifications');
12
+ const routesHelpers = nodebb.require('./src/routes/helpers');
13
+ const websockets = nodebb.require('./src/socket.io/index');
14
+ const SocketPlugins = nodebb.require('./src/socket.io/plugins');
15
+
16
+ const emojiParser = nodebb.require('nodebb-plugin-emoji/build/lib/parse.js');
17
17
 
18
18
  let emojiTable = null;
19
19
  let emojiAliases = null;
@@ -22,14 +22,14 @@ const DEFAULT_MAX_EMOTES = 4;
22
22
 
23
23
  function nameToEmoji(name) {
24
24
  if (!emojiTable) {
25
- emojiTable = require.main.require('nodebb-plugin-emoji/build/emoji/table.json');
25
+ emojiTable = nodebb.require('nodebb-plugin-emoji/build/emoji/table.json');
26
26
  }
27
27
  return emojiTable[name];
28
28
  }
29
29
 
30
30
  function parse(name) {
31
31
  if (!emojiAliases) {
32
- emojiAliases = require.main.require('nodebb-plugin-emoji/build/emoji/aliases.json');
32
+ emojiAliases = nodebb.require('nodebb-plugin-emoji/build/emoji/aliases.json');
33
33
  }
34
34
  const emoji = nameToEmoji(name) || emojiTable[emojiAliases[name]];
35
35
  return emoji ? emojiParser.buildEmoji(emoji, '') : '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodebb/nodebb-plugin-reactions",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "nbbpm": {
5
5
  "compatibility": "^4.14.0"
6
6
  },
@@ -38,8 +38,8 @@
38
38
  },
39
39
  "license": "MIT",
40
40
  "devDependencies": {
41
- "eslint": "10.0.2",
42
- "eslint-config-nodebb": "^2.0.0"
41
+ "eslint": "10.6.0",
42
+ "eslint-config-nodebb": "^2.0.3"
43
43
  },
44
44
  "scripts": {
45
45
  "lint": "eslint ."
package/public/client.js CHANGED
@@ -236,9 +236,9 @@ $(document).ready(function () {
236
236
  return;
237
237
  }
238
238
  if (usernames.length + data.otherCount > data.cutoff) {
239
- usernames = usernames.join(', ').replace(/,/g, '|');
240
- usernames = await translator.translate('[[topic:users_and_others, ' + usernames + ', ' + data.otherCount + ']]');
241
- usernames = usernames.replace(/\|/g, ',');
239
+ usernames = await translator.translate(
240
+ translator.compile('topic:users-and-others', usernames.join(', '), data.otherCount),
241
+ );
242
242
  } else {
243
243
  usernames = usernames.join(', ');
244
244
  }
@@ -1,10 +1,10 @@
1
1
  <form>
2
2
  <div class="mb-3">
3
- <label class="form-label" for="reaction">[[reactions:settings.reaction-reputations.reaction]]</label>
4
- <input type="text" id="reaction" name="reaction" class="form-control" placeholder="[[reactions:settings.reaction-reputations.reaction]]" />
3
+ <label class="form-label" for="reaction">{{tx("reactions:settings.reaction-reputations.reaction")}}</label>
4
+ <input type="text" id="reaction" name="reaction" class="form-control" placeholder="{{tx("reactions:settings.reaction-reputations.reaction")}}" />
5
5
  </div>
6
6
  <div class="mb-3">
7
- <label class="form-label" for="reputation">[[reactions:settings.reaction-reputations.reputation]]</label>
8
- <input type="number" id="reputation" name="reputation" class="form-control" placeholder="[[reactions:settings.reaction-reputations.reputation]]" />
7
+ <label class="form-label" for="reputation">{{tx("reactions:settings.reaction-reputations.reputation")}}</label>
8
+ <input type="number" id="reputation" name="reputation" class="form-control" placeholder="{{tx("reactions:settings.reaction-reputations.reputation")}}" />
9
9
  </div>
10
10
  </form>
@@ -2,11 +2,11 @@
2
2
  <div class="row align-items-center">
3
3
  <div class="col-9">
4
4
  <span data-reaction="{reaction}"></span><strong> {reaction}</strong><br />
5
- <small>[[reactions:settings.reaction-reputations.reputation]]: {reputation}</small>
5
+ <small>{{tx("reactions:settings.reaction-reputations.reputation")}}: {reputation}</small>
6
6
  </div>
7
7
  <div class="col-3 d-flex gap-2">
8
- <button type="button" data-type="edit" class="btn btn-sm btn-info">[[reactions:settings.reaction-reputations.edit]]</button>
9
- <button type="button" data-type="remove" class="btn btn-sm btn-danger">[[reactions:settings.reaction-reputations.remove]]</button>
8
+ <button type="button" data-type="edit" class="btn btn-sm btn-info">{{tx("reactions:settings.reaction-reputations.edit")}}</button>
9
+ <button type="button" data-type="remove" class="btn btn-sm btn-danger">{{tx("reactions:settings.reaction-reputations.remove")}}</button>
10
10
  </div>
11
11
  </div>
12
12
  </li>
@@ -6,50 +6,50 @@
6
6
  <div id="spy-container" class="col-12 col-md-8 px-0 mb-4" tabindex="0">
7
7
  <form role="form" class="reactions-settings">
8
8
  <div class="mb-3">
9
- <h5 class="fw-bold tracking-tight settings-header">[[reactions:settings.title]]</h5>
9
+ <h5 class="fw-bold tracking-tight settings-header">{{tx("reactions:settings.title")}}</h5>
10
10
  <div class="form-check form-switch mb-3">
11
11
  <input id="enablePostReactions" name="enablePostReactions" type="checkbox" class="form-check-input">
12
- <label for="enablePostReactions" class="form-check-label">[[reactions:settings.enable-post-reactions]]</label>
12
+ <label for="enablePostReactions" class="form-check-label">{{tx("reactions:settings.enable-post-reactions")}}</label>
13
13
  </div>
14
14
  <div class="mb-3">
15
- <label class="form-label">[[reactions:settings.max-reactions-per-post]]</label>
15
+ <label class="form-label">{{tx("reactions:settings.max-reactions-per-post")}}</label>
16
16
  <input type="number" min="0" class="form-control" id="maximumReactions" name="maximumReactions">
17
17
  </div>
18
18
  <div class="mb-3">
19
- <label class="form-label">[[reactions:settings.max-reactions-per-user-per-post]]</label>
19
+ <label class="form-label">{{tx("reactions:settings.max-reactions-per-user-per-post")}}</label>
20
20
  <input type="number" min="0" class="form-control" id="maximumReactionsPerUserPerPost" name="maximumReactionsPerUserPerPost">
21
21
  <p class="form-text">
22
- [[reactions:settings.max-reactions-per-user-per-post-help]]
22
+ {{tx("reactions:settings.max-reactions-per-user-per-post-help")}}
23
23
  </p>
24
24
  </div>
25
25
  <hr/>
26
26
  <div class="form-check form-switch mb-3">
27
27
  <input id="enableMessageReactions" name="enableMessageReactions" type="checkbox" class="form-check-input">
28
- <label for="enableMessageReactions" class="form-check-label">[[reactions:settings.enable-message-reactions]]</label>
28
+ <label for="enableMessageReactions" class="form-check-label">{{tx("reactions:settings.enable-message-reactions")}}</label>
29
29
  </div>
30
30
  <div class="mb-3">
31
- <label class="form-label">[[reactions:settings.max-reactions-per-message]]</label>
31
+ <label class="form-label">{{tx("reactions:settings.max-reactions-per-message")}}</label>
32
32
  <input type="number" min="0" class="form-control" id="maximumReactionsPerMessage" name="maximumReactionsPerMessage">
33
33
 
34
34
  </div>
35
35
  <div class="">
36
- <label class="form-label">[[reactions:settings.max-reactions-per-user-per-message]]</label>
36
+ <label class="form-label">{{tx("reactions:settings.max-reactions-per-user-per-message")}}</label>
37
37
  <input type="number" min="0" class="form-control" id="maximumReactionsPerUserPerMessage" name="maximumReactionsPerUserPerMessage">
38
38
  <p class="form-text">
39
- [[reactions:settings.max-reactions-per-user-per-message-help]]
39
+ {{tx("reactions:settings.max-reactions-per-user-per-message-help")}}
40
40
  </p>
41
41
  </div>
42
42
  </div>
43
43
 
44
44
  <div class="mb-3">
45
- <h5 class="fw-bold tracking-tight settings-header">[[reactions:settings.reaction-reputations]]</h5>
45
+ <h5 class="fw-bold tracking-tight settings-header">{{tx("reactions:settings.reaction-reputations")}}</h5>
46
46
 
47
47
  <p class="form-text">
48
- [[reactions:settings.reaction-reputations-help]]
48
+ {{tx("reactions:settings.reaction-reputations-help")}}
49
49
  </p>
50
50
  <div class="form-group" data-type="sorted-list" data-sorted-list="reaction-reputations" data-item-template="admin/plugins/reactions/partials/sorted-list/emoji-item" data-form-template="admin/plugins/reactions/partials/sorted-list/emoji-form">
51
51
  <ul data-type="list" class="list-group"></ul>
52
- <button type="button" data-type="add" class="btn btn-info mt-2">[[reactions:settings.reaction-reputations.add]]</button>
52
+ <button type="button" data-type="add" class="btn btn-info mt-2">{{tx("reactions:settings.reaction-reputations.add")}}</button>
53
53
  </div>
54
54
  </div>
55
55
  </form>
@@ -1,5 +1,5 @@
1
1
  {{{ if config.enableMessageReactions }}}
2
- <button class="reaction-add btn btn-sm btn-link {{{ if messages.maxReactionsReached }}}max-reactions{{{ end }}}" component="message/reaction/add" data-mid="{messages.mid}" title="[[reactions:add-reaction]]">
2
+ <button class="reaction-add btn btn-sm btn-link {{{ if messages.maxReactionsReached }}}max-reactions{{{ end }}}" component="message/reaction/add" data-mid="{messages.mid}" title="{{tx("reactions:add-reaction")}}">
3
3
  <i class="fa fa-face-smile"></i>
4
4
  </button>
5
5
  {{{ end }}}
@@ -3,7 +3,7 @@
3
3
  {{{ each ./reactions }}}
4
4
  <!-- IMPORT partials/topic/reaction.tpl -->
5
5
  {{{ end }}}
6
- <a href="#" class="reaction-add btn btn-ghost btn-sm {{{ if ./maxReactionsReached }}}max-reactions{{{ end }}}" component="post/reaction/add" data-pid="{./pid}" title="[[reactions:add-reaction]]">
6
+ <a href="#" class="reaction-add btn btn-ghost btn-sm {{{ if ./maxReactionsReached }}}max-reactions{{{ end }}}" component="post/reaction/add" data-pid="{./pid}" title="{{tx("reactions:add-reaction")}}">
7
7
  <i class="fa fa-face-smile text-primary"></i>
8
8
  </a>
9
9
  </span>