@nodebb/nodebb-plugin-reactions 2.2.10 → 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/README.md +5 -0
- package/library.js +21 -21
- package/package.json +4 -4
- package/public/client.js +3 -3
- package/templates/admin/plugins/reactions/partials/sorted-list/emoji-form.tpl +6 -6
- package/templates/admin/plugins/reactions/partials/sorted-list/emoji-item.tpl +6 -6
- package/templates/admin/plugins/reactions.tpl +12 -12
- package/templates/partials/chats/add-reaction.tpl +1 -1
- package/templates/partials/chats/reaction.tpl +1 -1
- package/templates/partials/topic/reaction.tpl +1 -1
- package/templates/partials/topic/reactions.tpl +1 -1
package/README.md
CHANGED
|
@@ -8,6 +8,11 @@ Install via one-click activation in the Admin Control Panel or run the following
|
|
|
8
8
|
|
|
9
9
|
npm i @nodebb/nodebb-plugin-reactions
|
|
10
10
|
|
|
11
|
+
# Emojis in Topic Titles and Notifications
|
|
12
|
+
|
|
13
|
+
In the admin settings of nodebb-plugin-emoji, turn on "Parse emojis in topic titles" to see emojis as images in topic titles and notifications.
|
|
14
|
+

|
|
15
|
+
|
|
11
16
|
# Screenshots
|
|
12
17
|
|
|
13
18
|
## Reactions:
|
package/library.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const meta =
|
|
4
|
-
const user =
|
|
5
|
-
const posts =
|
|
6
|
-
const topics =
|
|
7
|
-
const messaging =
|
|
8
|
-
const privileges =
|
|
9
|
-
const db =
|
|
10
|
-
const translator =
|
|
11
|
-
const notifications =
|
|
12
|
-
const routesHelpers =
|
|
13
|
-
const websockets =
|
|
14
|
-
const SocketPlugins =
|
|
15
|
-
|
|
16
|
-
const emojiParser =
|
|
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 =
|
|
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 =
|
|
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, '') : '';
|
|
@@ -375,18 +375,18 @@ SocketPlugins.reactions = {
|
|
|
375
375
|
}
|
|
376
376
|
|
|
377
377
|
if (postData.uid && postData.uid !== socket.uid) {
|
|
378
|
-
const [
|
|
379
|
-
user.
|
|
380
|
-
topics.
|
|
378
|
+
const [displayname, topicTitle, parsedPostData] = await Promise.all([
|
|
379
|
+
user.getNotificationDisplayname(socket.uid),
|
|
380
|
+
topics.getNotificationTitle(data.tid),
|
|
381
381
|
posts.parsePost(postData),
|
|
382
382
|
]);
|
|
383
383
|
const notifObj = await notifications.create({
|
|
384
384
|
type: 'reaction',
|
|
385
385
|
bodyShort: translator.compile(
|
|
386
386
|
'reactions:notification.user-has-reacted-with-to-your-post-in-topic',
|
|
387
|
-
|
|
387
|
+
displayname,
|
|
388
388
|
`:${data.reaction}:`,
|
|
389
|
-
|
|
389
|
+
topicTitle
|
|
390
390
|
),
|
|
391
391
|
bodyLong: parsedPostData.content,
|
|
392
392
|
nid: `uid:${socket.uid}:pid:${data.pid}:reaction:${data.reaction}`,
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nodebb/nodebb-plugin-reactions",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"nbbpm": {
|
|
5
|
-
"compatibility": "^
|
|
5
|
+
"compatibility": "^4.14.0"
|
|
6
6
|
},
|
|
7
7
|
"description": "Reactions plugin for NodeBB",
|
|
8
8
|
"main": "library.js",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
},
|
|
39
39
|
"license": "MIT",
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"eslint": "10.0
|
|
42
|
-
"eslint-config-nodebb": "^2.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 =
|
|
240
|
-
|
|
241
|
-
|
|
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
|
-
<div class="
|
|
3
|
-
<label for="reaction">
|
|
4
|
-
<input type="text" id="reaction" name="reaction" class="form-control" placeholder="
|
|
2
|
+
<div class="mb-3">
|
|
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
|
-
<div class="
|
|
7
|
-
<label for="reputation">
|
|
8
|
-
<input type="number" id="reputation" name="reputation" class="form-control" placeholder="
|
|
6
|
+
<div class="mb-3">
|
|
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>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<li data-type="item" class="list-group-item">
|
|
2
|
-
<div class="row">
|
|
3
|
-
<div class="col-
|
|
2
|
+
<div class="row align-items-center">
|
|
3
|
+
<div class="col-9">
|
|
4
4
|
<span data-reaction="{reaction}"></span><strong> {reaction}</strong><br />
|
|
5
|
-
<small>
|
|
5
|
+
<small>{{tx("reactions:settings.reaction-reputations.reputation")}}: {reputation}</small>
|
|
6
6
|
</div>
|
|
7
|
-
<div class="col-
|
|
8
|
-
<button type="button" data-type="edit" class="btn btn-info">
|
|
9
|
-
<button type="button" data-type="remove" class="btn btn-danger">
|
|
7
|
+
<div class="col-3 d-flex gap-2">
|
|
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">
|
|
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">
|
|
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">
|
|
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">
|
|
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
|
-
|
|
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">
|
|
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">
|
|
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">
|
|
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
|
-
|
|
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">
|
|
45
|
+
<h5 class="fw-bold tracking-tight settings-header">{{tx("reactions:settings.reaction-reputations")}}</h5>
|
|
46
46
|
|
|
47
47
|
<p class="form-text">
|
|
48
|
-
|
|
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">
|
|
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="
|
|
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 }}}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
<span class="reaction mb-2 {{{ if ./reacted }}}reacted{{{ end }}}" component="message/reaction" data-mid="{./mid}" data-reaction="{./reaction}">
|
|
2
|
-
{./reactionImage}
|
|
2
|
+
{{./reactionImage}}
|
|
3
3
|
<small class="reaction-emoji-count" data-count="{./reactionCount}"></small>
|
|
4
4
|
</span>
|
|
@@ -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="
|
|
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>
|