From 94cb000e8f4df90a2dfc22c009aa4d00596a2a2d Mon Sep 17 00:00:00 2001 From: chandi Date: Wed, 21 Oct 2020 19:04:03 +0200 Subject: [PATCH] plugins: include more data within padUpdate hook (#4425) * Including more data at pad update event * docs: new context fields in padUpdate Co-authored-by: Pedro Beschorner Marin --- doc/api/hooks_server-side.md | 2 ++ src/node/db/Pad.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/api/hooks_server-side.md b/doc/api/hooks_server-side.md index 4dbfd38b5..f51c722e5 100644 --- a/doc/api/hooks_server-side.md +++ b/doc/api/hooks_server-side.md @@ -169,6 +169,8 @@ Things in context: 1. pad - the pad instance 2. author - the id of the author who updated the pad +3. newRev - the index of the new revision +4. changeset - the changeset of this revision (see [Changeset Library](#index_changeset_library)) This hook gets called when an existing pad was updated. diff --git a/src/node/db/Pad.js b/src/node/db/Pad.js index f41e64a4c..b147f40e0 100644 --- a/src/node/db/Pad.js +++ b/src/node/db/Pad.js @@ -109,7 +109,7 @@ Pad.prototype.appendRevision = async function appendRevision(aChangeset, author) if (this.head == 0) { hooks.callAll("padCreate", {'pad':this, 'author': author}); } else { - hooks.callAll("padUpdate", {'pad':this, 'author': author}); + hooks.callAll("padUpdate", {'pad':this, 'author': author, 'revs': newRev, 'changeset': aChangeset}); } await Promise.all(p);