mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: update post cache clearing logic to call helper function
regression from 8cf9617630
This commit is contained in:
@@ -239,7 +239,7 @@ postsAPI.purge = async function (caller, data) {
|
||||
if (!canPurge) {
|
||||
throw new Error('[[error:no-privileges]]');
|
||||
}
|
||||
require('../posts/cache').del(data.pid);
|
||||
posts.clearCachedPost(data.pid);
|
||||
await Promise.all([
|
||||
posts.purge(data.pid, caller.uid),
|
||||
require('.').activitypub.delete.note(caller, { pid: data.pid }),
|
||||
|
||||
@@ -15,9 +15,7 @@ const slugify = require('../slugify');
|
||||
const translator = require('../translator');
|
||||
|
||||
module.exports = function (Posts) {
|
||||
pubsub.on('post:edit', (pid) => {
|
||||
require('./cache').del(pid);
|
||||
});
|
||||
pubsub.on('post:edit', pid => Posts.clearCachedPost(pid));
|
||||
|
||||
Posts.edit = async function (data) {
|
||||
const { _activitypub } = data;
|
||||
@@ -92,7 +90,7 @@ module.exports = function (Posts) {
|
||||
|
||||
plugins.hooks.fire('action:post.edit', { post: { ...returnPostData, _activitypub }, data: data, uid: data.uid });
|
||||
|
||||
require('./cache').del(String(postData.pid));
|
||||
Posts.clearCachedPost(String(postData.pid));
|
||||
pubsub.publish('post:edit', String(postData.pid));
|
||||
|
||||
await Posts.parsePost(returnPostData);
|
||||
|
||||
@@ -33,7 +33,7 @@ module.exports = function (Posts) {
|
||||
}
|
||||
let post;
|
||||
if (isDelete) {
|
||||
require('./cache').del(pid);
|
||||
Posts.clearCachedPost(pid);
|
||||
post = await Posts.delete(pid, uid);
|
||||
} else {
|
||||
post = await Posts.restore(pid, uid);
|
||||
|
||||
Reference in New Issue
Block a user