From 53092fa7af7f6c54596a4ce33bcd580eaedaf2f0 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Thu, 28 Jan 2021 00:35:46 -0500 Subject: [PATCH 1/2] db/Pad: Call padCopy and padRemove hooks asynchronously --- src/node/db/Pad.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/node/db/Pad.js b/src/node/db/Pad.js index 67842c14d..965f2793f 100644 --- a/src/node/db/Pad.js +++ b/src/node/db/Pad.js @@ -418,7 +418,7 @@ Pad.prototype.copy = async function copy(destinationID, force) { await padManager.getPad(destinationID, null); // this runs too early. // let the plugins know the pad was copied - hooks.callAll('padCopy', {originalPad: this, destinationID}); + await hooks.aCallAll('padCopy', {originalPad: this, destinationID}); return {padID: destinationID}; }; @@ -520,7 +520,7 @@ Pad.prototype.copyPadWithoutHistory = async function copyPadWithoutHistory(desti const changeset = Changeset.pack(oldLength, newLength, assem.toString(), newText); newPad.appendRevision(changeset); - hooks.callAll('padCopy', {originalPad: this, destinationID}); + await hooks.aCallAll('padCopy', {originalPad: this, destinationID}); return {padID: destinationID}; }; @@ -574,7 +574,7 @@ Pad.prototype.remove = async function remove() { // delete the pad entry and delete pad from padManager p.push(padManager.removePad(padID)); - hooks.callAll('padRemove', {padID}); + p.push(hooks.aCallAll('padRemove', {padID})); await Promise.all(p); }; From 7f392e12e971df679038dbc84a2d18b90bf999b8 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Thu, 28 Jan 2021 00:41:23 -0500 Subject: [PATCH 2/2] tests: Create a `src/tests/` symlink that points to `tests/` This makes it possible for plugin backend tests to do `require('ep_etherpad-lite/tests/backend/common')` to access the API key (among other things). Eventually we probably should reverse these (move `tests/` to `src/tests/` and make `tests/` a symlink to `src/tests/`) and move `bin/` to `src/bin/` so that we can avoid the top-level `package.json` mess. --- src/tests | 1 + 1 file changed, 1 insertion(+) create mode 120000 src/tests diff --git a/src/tests b/src/tests new file mode 120000 index 000000000..6dd24e02b --- /dev/null +++ b/src/tests @@ -0,0 +1 @@ +../tests \ No newline at end of file