nodebb-plugin-mentions 4.0.2 → 4.0.3
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
|
@@ -96,12 +96,12 @@ Mentions.notify = async function (data) {
|
|
|
96
96
|
return;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
const [topic,
|
|
99
|
+
const [topic, userData, topicFollowers] = await Promise.all([
|
|
100
100
|
Topics.getTopicFields(postData.tid, ['title', 'cid']),
|
|
101
|
-
User.
|
|
101
|
+
User.getUserFields(postData.uid, ['username']),
|
|
102
102
|
Mentions._settings.disableFollowedTopics === 'on' ? Topics.getFollowers(postData.tid) : [],
|
|
103
103
|
]);
|
|
104
|
-
|
|
104
|
+
const { displayname } = userData;
|
|
105
105
|
const title = entitiesDecode(topic.title);
|
|
106
106
|
const titleEscaped = title.replace(/%/g, '%').replace(/,/g, ',');
|
|
107
107
|
|
|
@@ -129,7 +129,7 @@ Mentions.notify = async function (data) {
|
|
|
129
129
|
|
|
130
130
|
const filteredUids = await filterUidsAlreadyMentioned(uids, postData.pid);
|
|
131
131
|
if (filteredUids.length) {
|
|
132
|
-
await sendNotificationToUids(postData, filteredUids, 'user', `[[notifications:user_mentioned_you_in, ${
|
|
132
|
+
await sendNotificationToUids(postData, filteredUids, 'user', `[[notifications:user_mentioned_you_in, ${displayname}, ${titleEscaped}]]`);
|
|
133
133
|
await db.setAdd(`mentions:pid:${postData.pid}:uids`, filteredUids);
|
|
134
134
|
}
|
|
135
135
|
|
|
@@ -139,7 +139,7 @@ Mentions.notify = async function (data) {
|
|
|
139
139
|
const groupName = groupsToNotify[i].name;
|
|
140
140
|
const groupMentionSent = await db.isSetMember(`mentions:pid:${postData.pid}:groups`, groupName);
|
|
141
141
|
if (!groupMentionSent && memberUids.length) {
|
|
142
|
-
await sendNotificationToUids(postData, memberUids, groupName, `[[notifications:user_mentioned_group_in, ${
|
|
142
|
+
await sendNotificationToUids(postData, memberUids, groupName, `[[notifications:user_mentioned_group_in, ${displayname} , ${groupName}, ${titleEscaped}]]`);
|
|
143
143
|
await db.setAdd(`mentions:pid:${postData.pid}:groups`, groupName);
|
|
144
144
|
}
|
|
145
145
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nodebb-plugin-mentions",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"description": "NodeBB Plugin that allows users to mention other users by prepending an '@' sign to their username",
|
|
5
5
|
"main": "library.js",
|
|
6
6
|
"scripts": {
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"xregexp": "^5.1.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"mocha": "10.
|
|
35
|
-
"eslint": "8.
|
|
36
|
-
"eslint-config-nodebb": "0.
|
|
37
|
-
"eslint-plugin-import": "2.
|
|
34
|
+
"mocha": "10.2.0",
|
|
35
|
+
"eslint": "8.32.0",
|
|
36
|
+
"eslint-config-nodebb": "0.2.1",
|
|
37
|
+
"eslint-plugin-import": "2.27.5"
|
|
38
38
|
}
|
|
39
39
|
}
|
package/static/admin.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
/* globals $, app, socket, define */
|
|
4
|
-
|
|
5
3
|
define('admin/plugins/mentions', ['settings', 'alerts'], function (Settings, alerts) {
|
|
6
|
-
|
|
7
|
-
var ACP = {};
|
|
4
|
+
const ACP = {};
|
|
8
5
|
|
|
9
6
|
ACP.init = function () {
|
|
10
7
|
Settings.load('mentions', $('.mentions-settings'));
|
|
@@ -18,9 +15,10 @@ define('admin/plugins/mentions', ['settings', 'alerts'], function (Settings, ale
|
|
|
18
15
|
alert_id: 'mentions-saved',
|
|
19
16
|
title: 'Settings Saved',
|
|
20
17
|
message: 'Please reload your NodeBB to apply these settings',
|
|
18
|
+
timeout: 5000,
|
|
21
19
|
clickfn: function () {
|
|
22
20
|
socket.emit('admin.reload');
|
|
23
|
-
}
|
|
21
|
+
},
|
|
24
22
|
});
|
|
25
23
|
});
|
|
26
24
|
});
|
|
@@ -34,4 +32,4 @@ define('admin/plugins/mentions', ['settings', 'alerts'], function (Settings, ale
|
|
|
34
32
|
}
|
|
35
33
|
|
|
36
34
|
return ACP;
|
|
37
|
-
});
|
|
35
|
+
});
|
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const db = module.parent.require('./database');
|
|
5
|
-
const batch = module.parent.require('./batch');
|
|
6
|
-
module.exports = {
|
|
7
|
-
name: 'Delete mentions:sent:<pid> sorted sets',
|
|
8
|
-
timestamp: Date.UTC(2021, 10, 2),
|
|
9
|
-
method: async function () {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
const db = module.parent.require('./database');
|
|
5
|
+
const batch = module.parent.require('./batch');
|
|
6
|
+
module.exports = {
|
|
7
|
+
name: 'Delete mentions:sent:<pid> sorted sets',
|
|
8
|
+
timestamp: Date.UTC(2021, 10, 2),
|
|
9
|
+
method: async function () {
|
|
10
|
+
const { progress } = this;
|
|
11
|
+
const nextPid = await db.getObjectField('global', 'nextPid');
|
|
12
|
+
const allPids = [];
|
|
13
|
+
for (let pid = 1; pid < nextPid; ++pid) {
|
|
14
|
+
allPids.push(pid);
|
|
15
|
+
}
|
|
16
|
+
progress.total = allPids.length;
|
|
17
|
+
await batch.processArray(allPids, async (pids) => {
|
|
18
|
+
progress.incr(pids.length);
|
|
19
|
+
await db.deleteAll(pids.map(pid => `mentions:sent:${pid}`));
|
|
20
|
+
}, {
|
|
21
|
+
batch: 500,
|
|
22
|
+
});
|
|
23
|
+
},
|
|
23
24
|
};
|