mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-04 10:48:32 +02:00
fix: update post cache clearing logic to call helper function
regression from 8cf9617630
This commit is contained in:
@@ -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