@nodebb/nodebb-plugin-reactions 2.2.6 → 2.2.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/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # nodebb-plugin-reactions
2
2
  Reactions plugin for NodeBB
3
3
 
4
+ This plugin requires nodebb-plugin-emoji to be active.
5
+
4
6
  # Installation
5
7
  Install via one-click activation in the Admin Control Panel or run the following command:
6
8
 
@@ -12,4 +14,4 @@ Install via one-click activation in the Admin Control Panel or run the following
12
14
  ![demo](./assets/demo.png)
13
15
 
14
16
  ## ACP:
15
- ![acp](./assets/acp.png)
17
+ ![acp](./assets/acp.png)
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ import serverConfig from 'eslint-config-nodebb';
4
+ import publicConfig from 'eslint-config-nodebb/public';
5
+
6
+ export default [
7
+ ...publicConfig,
8
+ ...serverConfig,
9
+ ];
10
+
@@ -0,0 +1,3 @@
1
+ {
2
+ "notificationType-reaction": "When someone reacts to your posts & chats"
3
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "reactions": "回应",
3
+ "add-reaction": "添加回应",
4
+ "error.invalid-reaction": "无效的回应",
5
+ "error.maximum-reached": "达到最大回应数",
6
+ "error.maximum-per-user-per-post-reached": "每个用户每篇帖子的最大回应数",
7
+ "settings.title": "回应插件设置",
8
+ "settings.enable-post-reactions": "启用帖子回应",
9
+ "settings.max-reactions-per-post": "每个帖子的最大唯一回应数(0 表示无限制,默认值:4)",
10
+ "settings.max-reactions-per-user-per-post": "每个用户每个帖子的最大回应数(0 表示无限制)",
11
+ "settings.max-reactions-per-user-per-post-help": "该限制仅在添加新回应时有效,在添加现有回应时无效。",
12
+ "settings.enable-message-reactions": "启用信息回应",
13
+ "settings.max-reactions-per-message": "每条信息的最大唯一回应数(0 表示无限制,默认值:4)",
14
+ "settings.max-reactions-per-user-per-message": "每个用户每条信息的最大回应次数(0 表示无限制)",
15
+ "settings.max-reactions-per-user-per-message-help": "该限制仅在添加新回应时有效,在添加现有回应时无效。",
16
+ "settings.reaction-reputations": "回应声望(可选)",
17
+ "settings.reaction-reputations-help": "您可以为单个回应分配声望。当一个回应应用到一个帖子时,该帖子的所有者就会得到这个声望。",
18
+ "settings.reaction-reputations.add": "添加规则",
19
+ "settings.reaction-reputations.reaction": "回应",
20
+ "settings.reaction-reputations.reputation": "声望",
21
+ "settings.reaction-reputations.remove": "删除",
22
+ "settings.reaction-reputations.edit": "编辑",
23
+ "notification.user-has-reacted-with-to-your-post-in-topic": "<strong>%1</strong> 已用 %2 对您在 <strong>%3</strong> 中发表的帖子做出了回应",
24
+ "notification.user-has-reacted-with-to-your-message-in-room": "<strong>%1</strong> 已用 %2 对您在 <strong class=\"text-nowrap\"><i class=\"fa %3\"></i>%4</strong> 中的信息做出了回应"
25
+ }
package/library.js CHANGED
@@ -81,6 +81,16 @@ ReactionsPlugin.filterSettingsGet = async function (hookData) {
81
81
  return hookData;
82
82
  };
83
83
 
84
+ ReactionsPlugin.addNotificationFilters = async (data) => {
85
+ data.regularFilters.push({ name: '[[reactions:reactions]]', filter: 'reaction' });
86
+ return data;
87
+ };
88
+
89
+ ReactionsPlugin.notificationTypes = async (data) => {
90
+ data.types.push('notificationType_reaction');
91
+ return data;
92
+ };
93
+
84
94
  ReactionsPlugin.getPostReactions = async function (data) {
85
95
  if (data.uid === 0) {
86
96
  return data;
@@ -370,6 +380,7 @@ SocketPlugins.reactions = {
370
380
  topics.getTopicFields(data.tid, ['title']),
371
381
  ]);
372
382
  const notifObj = await notifications.create({
383
+ type: 'reaction',
373
384
  bodyShort: translator.compile(
374
385
  'reactions:notification.user-has-reacted-with-to-your-post-in-topic',
375
386
  userData.displayname,
@@ -484,6 +495,7 @@ SocketPlugins.reactions = {
484
495
  const icon = messaging.getRoomIcon(roomData);
485
496
 
486
497
  const notifObj = await notifications.create({
498
+ type: 'reaction',
487
499
  bodyShort: translator.compile(
488
500
  'reactions:notification.user-has-reacted-with-to-your-message-in-room',
489
501
  userData.displayname,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodebb/nodebb-plugin-reactions",
3
- "version": "2.2.6",
3
+ "version": "2.2.8",
4
4
  "nbbpm": {
5
5
  "compatibility": "^3.6.0 || ^4.0.0"
6
6
  },
@@ -38,9 +38,8 @@
38
38
  },
39
39
  "license": "MIT",
40
40
  "devDependencies": {
41
- "eslint": "^8.40.0",
42
- "eslint-config-nodebb": "^0.2.1",
43
- "eslint-plugin-import": "^2.27.5"
41
+ "eslint": "9.28.0",
42
+ "eslint-config-nodebb": "1.1.7"
44
43
  },
45
44
  "scripts": {
46
45
  "lint": "eslint ."
package/plugin.json CHANGED
@@ -16,29 +16,15 @@
16
16
  "../admin/plugins/reactions.js": "./public/admin.js"
17
17
  },
18
18
  "hooks": [
19
- {
20
- "hook": "static:app.load", "method": "init"
21
- },
22
- {
23
- "hook": "filter:admin.header.build", "method": "addAdminNavigation"
24
- },
25
- {
26
- "hook": "filter:config.get", "method": "getPluginConfig"
27
- },
28
- {
29
- "hook": "filter:settings.get", "method": "filterSettingsGet"
30
- },
31
- {
32
- "hook": "filter:post.getPosts", "method": "getPostReactions"
33
- },
34
- {
35
- "hook": "filter:messaging.getMessages", "method": "getMessageReactions"
36
- },
37
- {
38
- "hook": "filter:post.get", "method": "onReply"
39
- },
40
- {
41
- "hook": "action:posts.purge", "method": "deleteReactions"
42
- }
19
+ { "hook": "static:app.load", "method": "init" },
20
+ { "hook": "filter:admin.header.build", "method": "addAdminNavigation"},
21
+ { "hook": "filter:config.get", "method": "getPluginConfig" },
22
+ { "hook": "filter:settings.get", "method": "filterSettingsGet" },
23
+ { "hook": "filter:post.getPosts", "method": "getPostReactions" },
24
+ { "hook": "filter:messaging.getMessages", "method": "getMessageReactions" },
25
+ { "hook": "filter:post.get", "method": "onReply" },
26
+ { "hook": "action:posts.purge", "method": "deleteReactions" },
27
+ { "hook": "filter:notifications.addFilters", "method": "addNotificationFilters" },
28
+ { "hook": "filter:user.notificationTypes", "method": "notificationTypes" }
43
29
  ]
44
30
  }
package/.eslintrc DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "extends": "nodebb/lib",
3
- "rules": {
4
- "no-continue": "off"
5
- }
6
- }