nodebb-plugin-dbsearch 6.3.5 → 6.4.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/lib/dbsearch.js +18 -2
- package/package.json +5 -6
- package/plugin.json +1 -1
- package/public/admin.js +4 -4
package/lib/dbsearch.js
CHANGED
|
@@ -142,8 +142,24 @@ search.actionTopicDelete = async function (data) {
|
|
|
142
142
|
]);
|
|
143
143
|
};
|
|
144
144
|
|
|
145
|
-
search.
|
|
146
|
-
|
|
145
|
+
search.actionTopicsPurge = async function (data) {
|
|
146
|
+
if (!data || !data.topics) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
async function removeTidsPids() {
|
|
150
|
+
await Promise.all(data.topics.map(async (t) => {
|
|
151
|
+
batch.processSortedSet(`tid:${t.tid}:posts`, async (pids) => {
|
|
152
|
+
await searchRemove('post', pids);
|
|
153
|
+
}, {
|
|
154
|
+
batch: batchSize,
|
|
155
|
+
});
|
|
156
|
+
}));
|
|
157
|
+
}
|
|
158
|
+
await Promise.all([
|
|
159
|
+
searchRemove('topic', data.topics.map(t => t.tid)),
|
|
160
|
+
searchRemove('post', data.topics.map(t => t.mainPid)),
|
|
161
|
+
removeTidsPids(),
|
|
162
|
+
]);
|
|
147
163
|
};
|
|
148
164
|
|
|
149
165
|
search.actionTopicMove = function (data) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nodebb-plugin-dbsearch",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.4.1",
|
|
4
4
|
"description": "A Plugin that lets users search posts and topics",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -19,15 +19,14 @@
|
|
|
19
19
|
"author": "Baris Usakli <baris@designcreateplay.com>",
|
|
20
20
|
"license": "BSD-2-Clause",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"lodash": "4.17.
|
|
22
|
+
"lodash": "4.17.23",
|
|
23
23
|
"redisearch": "^2.0.1"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"eslint": "^
|
|
27
|
-
"eslint-config-nodebb": "^
|
|
28
|
-
"eslint-plugin-import": "^2.31.0"
|
|
26
|
+
"eslint": "^10.0.3",
|
|
27
|
+
"eslint-config-nodebb": "^2.0.1"
|
|
29
28
|
},
|
|
30
29
|
"nbbpm": {
|
|
31
|
-
"compatibility": "^4.
|
|
30
|
+
"compatibility": "^4.9.0"
|
|
32
31
|
}
|
|
33
32
|
}
|
package/plugin.json
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
{ "hook": "action:topic.restore", "method": "actionTopicRestore" },
|
|
27
27
|
{ "hook": "action:topic.edit", "method": "actionTopicEdit" },
|
|
28
28
|
{ "hook": "action:topic.delete", "method": "actionTopicDelete" },
|
|
29
|
-
{ "hook": "action:
|
|
29
|
+
{ "hook": "action:topics.purge", "method": "actionTopicsPurge" },
|
|
30
30
|
{ "hook": "action:topic.move", "method": "actionTopicMove" },
|
|
31
31
|
{ "hook": "action:topic.changeOwner", "method": "actionTopicChangeOwner" },
|
|
32
32
|
|
package/public/admin.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
define('admin/plugins/dbsearch', [
|
|
4
4
|
'alerts', 'admin/settings',
|
|
5
5
|
], function (alerts, settings) {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
const dbsearch = {};
|
|
7
|
+
let intervalId = 0;
|
|
8
8
|
|
|
9
9
|
$(window).on('action:ajaxify.end', function (ev, data) {
|
|
10
10
|
if (data.url === 'admin/plugins/dbsearch' && ajaxify.data.working) {
|
|
@@ -66,7 +66,7 @@ define('admin/plugins/dbsearch', [
|
|
|
66
66
|
});
|
|
67
67
|
|
|
68
68
|
$('#changeLanguage').on('click', function () {
|
|
69
|
-
|
|
69
|
+
const lang = $('#indexLanguage').val();
|
|
70
70
|
alerts.success('Changing index language to "' + lang + '".');
|
|
71
71
|
socket.emit('admin.plugins.dbsearch.changeLanguage', lang, function (err) {
|
|
72
72
|
if (err) {
|
|
@@ -106,7 +106,7 @@ define('admin/plugins/dbsearch', [
|
|
|
106
106
|
$('.post-progress').css('width', progress.postsPercent + '%').text(progress.postsPercent + '%');
|
|
107
107
|
$('.message-progress').css('width', progress.messagesPercent + '%').text(progress.messagesPercent + '%');
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
const working = parseInt(progress.working, 10);
|
|
110
110
|
if (!working) {
|
|
111
111
|
clearInterval(intervalId);
|
|
112
112
|
$('#reindex').removeAttr('disabled');
|