diff --git a/CHANGELOG.md b/CHANGELOG.md index 40ee51e6d..ae6ed4c65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,7 @@ * New `expressPreSession` server-side hook. * Pad server-side hook changes: + * `padCheck`: New hook. * `padCopy`: New `srcPad` and `dstPad` context properties. * `padDefaultContent`: New hook. * `padRemove`: New `pad` context property. diff --git a/doc/api/hooks_server-side.md b/doc/api/hooks_server-side.md index ccd09bfdd..de2aaa74e 100644 --- a/doc/api/hooks_server-side.md +++ b/doc/api/hooks_server-side.md @@ -366,6 +366,18 @@ Usage examples: * https://github.com/ether/ep_comments_page +## `padCheck` + +Called from: `src/node/db/Pad.js` + +Called when a consistency check is run on a pad, after the core checks have +completed successfully. An exception should be thrown if the pad is faulty in +some way. + +Context properties: + + * `pad`: The Pad object that is being checked. + ## socketio Called from: src/node/hooks/express/socketio.js diff --git a/src/node/db/Pad.js b/src/node/db/Pad.js index 8be40a0eb..1cbbdf732 100644 --- a/src/node/db/Pad.js +++ b/src/node/db/Pad.js @@ -738,4 +738,6 @@ Pad.prototype.check = async function () { err.message = pfx + err.message; throw err; } + + await hooks.aCallAll('padCheck', {pad: this}); };