Skip to content

Commit fba4a17

Browse files
JohnMcLearclaude
andauthored
fix(API): hide SYSTEM_AUTHOR_ID from listAuthorsOfPad (#7793)
* fix(API): exclude SYSTEM_AUTHOR_ID from listAuthorsOfPad Pad.SYSTEM_AUTHOR_ID ('a.etherpad-system') is the synthetic author Etherpad attributes inserts to when the HTTP API receives a call without authorId (setText, setHTML, appendText, the server-side import flows, and plugins like ep_post_data). It exists so the changeset's text and attribs stay in sync — without ANY author attribute, pad.atext drifts and clients fail setDocAText reconciliation when loading the pad. See Pad.ts:96-105 for the full rationale. That bookkeeping detail was leaking through listAuthorsOfPad: a pad whose only "contributor" is the system author still reported one authorID, which the existing tests in pad.ts and appendTextAuthor.ts (and presumably any caller that uses listAuthorsOfPad to count real users) treat as a real participant. Filter SYSTEM_AUTHOR_ID at the API surface so internal attribution stays internal. getAllAuthors() and downstream callers (copy, anonymize, atext verification) keep seeing the synthetic id — this only narrows the public listAuthorsOfPad response. Fixes #7785 Fixes #7790 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(api): note that listAuthorsOfPad omits the system author Match the runtime behaviour from the previous commit — the synthetic 'a.etherpad-system' author used for unattributed inserts is filtered out of the listAuthorsOfPad response. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 8c6104c commit fba4a17

3 files changed

Lines changed: 11 additions & 1 deletion

File tree

doc/api/http_api.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,8 @@ _Example returns:_
654654

655655
returns an array of authors who contributed to this pad
656656

657+
The synthetic `a.etherpad-system` author (used internally when content is inserted without an explicit `authorId` — HTTP API `setText`/`appendText`/`setHTML` calls without `authorId`, server-side imports, plugins like `ep_post_data`) is omitted from the returned list.
658+
657659
_Example returns:_
658660

659661
* `{code: 0, message:"ok", data: {authorIDs : ["a.s8oes9dhwrvt0zif", "a.akf8finncvomlqva"]}`

doc/api/http_api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,8 @@ return true of false
698698

699699
returns an array of authors who contributed to this pad
700700

701+
The synthetic `a.etherpad-system` author (used internally when content is inserted without an explicit `authorId` — HTTP API `setText`/`appendText`/`setHTML` calls without `authorId`, server-side imports, plugins like `ep_post_data`) is omitted from the returned list.
702+
701703
*Example returns:*
702704
* `{code: 0, message:"ok", data: {authorIDs : ["a.s8oes9dhwrvt0zif", "a.akf8finncvomlqva"]}`
703705
* `{code: 1, message:"padID does not exist", data: null}`

src/node/db/API.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,13 @@ Example returns:
855855
exports.listAuthorsOfPad = async (padID: string) => {
856856
// get the pad
857857
const pad = await getPadSafe(padID, true);
858-
const authorIDs = pad.getAllAuthors();
858+
// Pad.SYSTEM_AUTHOR_ID is the synthetic author Etherpad attributes inserts to
859+
// when no authorId is supplied (HTTP API setText/appendText/setHTML without
860+
// authorId, server-side import flows, plugins like ep_post_data). It is an
861+
// implementation detail of changeset bookkeeping, not a real contributor, so
862+
// it should not surface through this public API.
863+
const {Pad} = require('./Pad');
864+
const authorIDs = pad.getAllAuthors().filter((id: string) => id !== Pad.SYSTEM_AUTHOR_ID);
859865
return {authorIDs};
860866
};
861867

0 commit comments

Comments
 (0)