From b38d66b30ba4f91e7389f71deb4be0a3725040f5 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Fri, 8 Apr 2022 15:26:11 -0400 Subject: [PATCH] Pad: Move `padLoad` hook to `Pad.init()` --- CHANGELOG.md | 1 + src/node/db/Pad.js | 1 + src/node/db/PadManager.js | 2 -- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae6ed4c65..a7a991ef5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -76,6 +76,7 @@ instead. * `padCreate`: The `author` context property is deprecated; use the new `authorId` context property instead. + * `padLoad`: Now runs when a temporary Pad object is created during import. * `padRemove`: The `padID` context property is deprecated; use `pad.id` instead. * `padUpdate`: The `author` context property is deprecated; use the new diff --git a/src/node/db/Pad.js b/src/node/db/Pad.js index 1cbbdf732..8e824eaac 100644 --- a/src/node/db/Pad.js +++ b/src/node/db/Pad.js @@ -395,6 +395,7 @@ Pad.prototype.init = async function (text, authorId = '') { const firstChangeset = Changeset.makeSplice('\n', 0, 0, text); await this.appendRevision(firstChangeset, authorId); } + hooks.callAll('padLoad', {pad: this}); }; Pad.prototype.copy = async function (destinationID, force) { diff --git a/src/node/db/PadManager.js b/src/node/db/PadManager.js index 861e54710..e419e8392 100644 --- a/src/node/db/PadManager.js +++ b/src/node/db/PadManager.js @@ -22,7 +22,6 @@ const CustomError = require('../utils/customError'); const Pad = require('../db/Pad'); const db = require('./DB'); -const hooks = require('../../static/js/pluginfw/hooks'); /** * A cache of all loaded Pads. @@ -126,7 +125,6 @@ exports.getPad = async (id, text, authorId = '') => { // initialize the pad await pad.init(text, authorId); - hooks.callAll('padLoad', {pad}); globalPads.set(id, pad); padList.addPad(id);