mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 23:46:14 -04:00
Pad: Plumb author ID through mutation operations
This commit is contained in:
parent
5f60b3aab2
commit
3b8549342a
7 changed files with 35 additions and 30 deletions
|
@ -91,9 +91,11 @@ const padList = new class {
|
|||
/**
|
||||
* Returns a Pad Object with the callback
|
||||
* @param id A String with the id of the pad
|
||||
* @param {Function} callback
|
||||
* @param {string} [text] - Optional initial pad text if creating a new pad.
|
||||
* @param {string} [authorId] - Optional author ID of the user that initiated the pad creation (if
|
||||
* applicable).
|
||||
*/
|
||||
exports.getPad = async (id, text) => {
|
||||
exports.getPad = async (id, text, authorId = '') => {
|
||||
// check if this is a valid padId
|
||||
if (!exports.isValidPadId(id)) {
|
||||
throw new CustomError(`${id} is not a valid padId`, 'apierror');
|
||||
|
@ -123,7 +125,7 @@ exports.getPad = async (id, text) => {
|
|||
pad = new Pad.Pad(id);
|
||||
|
||||
// initialize the pad
|
||||
await pad.init(text);
|
||||
await pad.init(text, authorId);
|
||||
hooks.callAll('padLoad', {pad});
|
||||
globalPads.set(id, pad);
|
||||
padList.addPad(id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue