Pad: New `padRemove` hook `pad` context property

pull/5505/head
Richard Hansen 2022-04-08 03:06:23 -04:00
parent 8fe779b58c
commit a2460a9848
3 changed files with 11 additions and 2 deletions

View File

@ -42,6 +42,7 @@
* Pad server-side hook changes: * Pad server-side hook changes:
* `padCopy`: New `srcPad` and `dstPad` context properties. * `padCopy`: New `srcPad` and `dstPad` context properties.
* `padDefaultContent`: New hook. * `padDefaultContent`: New hook.
* `padRemove`: New `pad` context property.
* The `db` property on Pad objects is now public. * The `db` property on Pad objects is now public.
* New `getAuthorId` server-side hook. * New `getAuthorId` server-side hook.
* New APIs for processing attributes: `ep_etherpad-lite/static/js/attributes` * New APIs for processing attributes: `ep_etherpad-lite/static/js/attributes`
@ -74,6 +75,8 @@
instead. instead.
* `padCreate`: The `author` context property is deprecated; use the new * `padCreate`: The `author` context property is deprecated; use the new
`authorId` context property instead. `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 * `padUpdate`: The `author` context property is deprecated; use the new
`authorId` context property instead. `authorId` context property instead.
* Returning `true` from a `handleMessageSecurity` hook function is deprecated; * Returning `true` from a `handleMessageSecurity` hook function is deprecated;

View File

@ -360,7 +360,7 @@ up any plugin-specific pad records from the database.
Context properties: Context properties:
* `padID`: ID of the pad that is being deleted. * `pad`: Pad object for the pad that is being deleted.
Usage examples: Usage examples:

View File

@ -594,7 +594,13 @@ Pad.prototype.remove = async function () {
// delete the pad entry and delete pad from padManager // delete the pad entry and delete pad from padManager
p.push(padManager.removePad(padID)); 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); await Promise.all(p);
}; };