feat: rebuild page tree worker
This commit is contained in:
@@ -97,7 +97,7 @@ module.exports = {
|
||||
}
|
||||
|
||||
// Check source asset permissions
|
||||
const assetSourcePath = (asset.folderId) ? hierarchy.map(h => h.slug).join('/') + `/${filename}` : filename
|
||||
const assetSourcePath = (asset.folderId) ? hierarchy.map(h => h.slug).join('/') + `/${asset.filename}` : asset.filename
|
||||
if (!WIKI.auth.checkAccess(context.req.user, ['manage:assets'], { path: assetSourcePath })) {
|
||||
throw new WIKI.Error.AssetRenameForbidden()
|
||||
}
|
||||
@@ -118,6 +118,16 @@ module.exports = {
|
||||
// Delete old asset cache
|
||||
await asset.deleteAssetCache()
|
||||
|
||||
// Rename in Storage
|
||||
await WIKI.models.storage.assetEvent({
|
||||
event: 'renamed',
|
||||
asset: {
|
||||
...asset,
|
||||
sourcePath: assetSourcePath,
|
||||
destinationPath: assetTargetPath
|
||||
}
|
||||
})
|
||||
|
||||
return {
|
||||
responseResult: graphHelper.generateSuccess('Asset has been renamed successfully.')
|
||||
}
|
||||
@@ -145,6 +155,12 @@ module.exports = {
|
||||
await WIKI.models.assets.query().deleteById(args.id)
|
||||
await asset.deleteAssetCache()
|
||||
|
||||
// Delete from Storage
|
||||
await WIKI.models.storage.assetEvent({
|
||||
event: 'deleted',
|
||||
asset
|
||||
})
|
||||
|
||||
return {
|
||||
responseResult: graphHelper.generateSuccess('Asset has been deleted successfully.')
|
||||
}
|
||||
|
Reference in New Issue
Block a user