nodebb-plugin-mentions 3.0.0 → 3.0.4
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 +6 -4
- package/package.json +4 -4
- package/static/admin.js +36 -35
- package/static/autofill.js +4 -1
- package/upgrades/mentions_delete_mentions_set_zset.js +2 -0
package/library.js
CHANGED
|
@@ -170,10 +170,12 @@ async function getGroupsToNotify(matches) {
|
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
Mentions.actionPostPurge = async (hookData) => {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
173
|
+
if (hookData && hookData.post) {
|
|
174
|
+
await db.deleteAll([
|
|
175
|
+
`mentions:pid:${hookData.post.pid}:uids`,
|
|
176
|
+
`mentions:pid:${hookData.post.pid}:groups`,
|
|
177
|
+
]);
|
|
178
|
+
}
|
|
177
179
|
};
|
|
178
180
|
|
|
179
181
|
async function filterUidsAlreadyMentioned(uids, pid) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nodebb-plugin-mentions",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.4",
|
|
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": {
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"mocha": "9.1.3",
|
|
35
|
-
"eslint": "8.
|
|
36
|
-
"eslint-config-nodebb": "
|
|
37
|
-
"eslint-plugin-import": "
|
|
35
|
+
"eslint": "8.4.0",
|
|
36
|
+
"eslint-config-nodebb": "0.1.1",
|
|
37
|
+
"eslint-plugin-import": "2.25.3"
|
|
38
38
|
}
|
|
39
39
|
}
|
package/static/admin.js
CHANGED
|
@@ -1,36 +1,37 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
$('input#autofillGroups').
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/* globals $, app, socket, define */
|
|
4
|
+
|
|
5
|
+
define('admin/plugins/mentions', ['settings', 'alerts'], function (Settings, alerts) {
|
|
6
|
+
|
|
7
|
+
var ACP = {};
|
|
8
|
+
|
|
9
|
+
ACP.init = function () {
|
|
10
|
+
Settings.load('mentions', $('.mentions-settings'));
|
|
11
|
+
|
|
12
|
+
$(window).on('action:admin.settingsLoaded', applyDefaults);
|
|
13
|
+
|
|
14
|
+
$('#save').on('click', function () {
|
|
15
|
+
Settings.save('mentions', $('.mentions-settings'), function () {
|
|
16
|
+
alerts.alert({
|
|
17
|
+
type: 'success',
|
|
18
|
+
alert_id: 'mentions-saved',
|
|
19
|
+
title: 'Settings Saved',
|
|
20
|
+
message: 'Please reload your NodeBB to apply these settings',
|
|
21
|
+
clickfn: function () {
|
|
22
|
+
socket.emit('admin.reload');
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
function applyDefaults() {
|
|
30
|
+
if (!ajaxify.data.settings || !ajaxify.data.settings.hasOwnProperty('autofillGroups')) {
|
|
31
|
+
$('input#autofillGroups').parents('.mdl-switch').toggleClass('is-checked', false);
|
|
32
|
+
$('input#autofillGroups').prop('checked', false);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return ACP;
|
|
36
37
|
});
|
package/static/autofill.js
CHANGED
|
@@ -118,7 +118,10 @@ $(document).ready(function() {
|
|
|
118
118
|
function loadGroupList() {
|
|
119
119
|
socket.emit('plugins.mentions.listGroups', function(err, groupNames) {
|
|
120
120
|
if (err) {
|
|
121
|
-
|
|
121
|
+
require(['alerts'], function (alerts) {
|
|
122
|
+
alerts.error(err);
|
|
123
|
+
})
|
|
124
|
+
return;
|
|
122
125
|
}
|
|
123
126
|
groupList = groupNames;
|
|
124
127
|
});
|
|
@@ -7,12 +7,14 @@ module.exports = {
|
|
|
7
7
|
name: 'Delete mentions:sent:<pid> sorted sets',
|
|
8
8
|
timestamp: Date.UTC(2021, 10, 2),
|
|
9
9
|
method: async function () {
|
|
10
|
+
const { progress } = this;
|
|
10
11
|
const nextPid = await db.getObjectField('global', 'nextPid');
|
|
11
12
|
const allPids = [];
|
|
12
13
|
for (let pid = 1; pid < nextPid; ++ pid) {
|
|
13
14
|
allPids.push(pid);
|
|
14
15
|
}
|
|
15
16
|
await batch.processArray(allPids, async (pids) => {
|
|
17
|
+
progress.incr(pids.length);
|
|
16
18
|
await db.deleteAll(pids.map(pid => `mentions:sent:${pid}`));
|
|
17
19
|
}, {
|
|
18
20
|
batch: 500,
|