diff --git a/CHANGELOG.md b/CHANGELOG.md index 19a3ab415..40ee51e6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ * Pad server-side hook changes: * `padCopy`: New `srcPad` and `dstPad` context properties. * `padDefaultContent`: New hook. + * `padRemove`: New `pad` context property. * The `db` property on Pad objects is now public. * New `getAuthorId` server-side hook. * New APIs for processing attributes: `ep_etherpad-lite/static/js/attributes` @@ -74,6 +75,8 @@ instead. * `padCreate`: The `author` context property is deprecated; use the new `authorId` context property instead. + * `padRemove`: The `padID` context property is deprecated; use `pad.id` + instead. * `padUpdate`: The `author` context property is deprecated; use the new `authorId` context property instead. * Returning `true` from a `handleMessageSecurity` hook function is deprecated; diff --git a/doc/api/hooks_server-side.md b/doc/api/hooks_server-side.md index a4e9a9050..ccd09bfdd 100644 --- a/doc/api/hooks_server-side.md +++ b/doc/api/hooks_server-side.md @@ -360,7 +360,7 @@ up any plugin-specific pad records from the database. Context properties: - * `padID`: ID of the pad that is being deleted. + * `pad`: Pad object for the pad that is being deleted. Usage examples: diff --git a/src/node/db/Pad.js b/src/node/db/Pad.js index ece17961b..8be40a0eb 100644 --- a/src/node/db/Pad.js +++ b/src/node/db/Pad.js @@ -594,7 +594,13 @@ Pad.prototype.remove = async function () { // delete the pad entry and delete pad from padManager p.push(padManager.removePad(padID)); - p.push(hooks.aCallAll('padRemove', {padID})); + p.push(hooks.aCallAll('padRemove', { + get padID() { + warnDeprecated('padRemove padID context property is deprecated; use pad.id instead'); + return this.pad.id; + }, + pad: this, + })); await Promise.all(p); };