@nodebb/nodebb-plugin-reactions 2.2.9 → 3.0.0
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 +6 -6
- package/package.json +4 -4
- package/public/admin.js +1 -1
- package/public/client.js +17 -17
- package/templates/admin/plugins/reactions/partials/sorted-list/emoji-form.tpl +4 -4
- package/templates/admin/plugins/reactions/partials/sorted-list/emoji-item.tpl +6 -6
- package/templates/partials/chats/reaction.tpl +1 -1
- package/templates/partials/topic/reaction.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
|
@@ -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}`,
|
|
@@ -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,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nodebb/nodebb-plugin-reactions",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
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": "
|
|
42
|
-
"eslint-config-nodebb": "
|
|
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
|
-
|
|
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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
|
|
65
|
-
|
|
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
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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');
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<form>
|
|
2
|
-
<div class="
|
|
3
|
-
<label for="reaction">[[reactions:settings.reaction-reputations.reaction]]</label>
|
|
2
|
+
<div class="mb-3">
|
|
3
|
+
<label class="form-label" for="reaction">[[reactions:settings.reaction-reputations.reaction]]</label>
|
|
4
4
|
<input type="text" id="reaction" name="reaction" class="form-control" placeholder="[[reactions:settings.reaction-reputations.reaction]]" />
|
|
5
5
|
</div>
|
|
6
|
-
<div class="
|
|
7
|
-
<label for="reputation">[[reactions:settings.reaction-reputations.reputation]]</label>
|
|
6
|
+
<div class="mb-3">
|
|
7
|
+
<label class="form-label" for="reputation">[[reactions:settings.reaction-reputations.reputation]]</label>
|
|
8
8
|
<input type="number" id="reputation" name="reputation" class="form-control" placeholder="[[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>[[reactions:settings.reaction-reputations.
|
|
5
|
+
<small>[[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">[[reactions:settings.reaction-reputations.edit]]</button>
|
|
9
|
-
<button type="button" data-type="remove" class="btn btn-danger">[[reactions:settings.reaction-reputations.remove]]</button>
|
|
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>
|
|
10
10
|
</div>
|
|
11
11
|
</div>
|
|
12
12
|
</li>
|
|
@@ -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>
|