nodebb-plugin-dbsearch 6.3.5 → 6.4.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 +10 -10
- package/index.js +4 -4
- package/lib/dbsearch.js +18 -2
- package/package.json +2 -2
- package/plugin.json +1 -1
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
# NodeBB Plugin DB Search
|
|
2
|
-
|
|
3
|
-
A Plugin that lets users search posts and topics
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
npm install nodebb-plugin-dbsearch
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
# NodeBB Plugin DB Search
|
|
2
|
+
|
|
3
|
+
A Plugin that lets users search posts and topics
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
npm install nodebb-plugin-dbsearch
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
module.exports = require('./lib/dbsearch');
|
|
4
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports = require('./lib/dbsearch');
|
|
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.0",
|
|
4
4
|
"description": "A Plugin that lets users search posts and topics",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -28,6 +28,6 @@
|
|
|
28
28
|
"eslint-plugin-import": "^2.31.0"
|
|
29
29
|
},
|
|
30
30
|
"nbbpm": {
|
|
31
|
-
"compatibility": "^4.
|
|
31
|
+
"compatibility": "^4.9.0"
|
|
32
32
|
}
|
|
33
33
|
}
|
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
|
|