fix: add padId to padUpdate/padCreate hook context (#7452)

The pad object's toJSON() intentionally strips the id property (since
it's part of the database key), which caused confusion when plugins
serialized the hook context. Adding padId as a top-level property on
the hook context makes it directly accessible without relying on the
pad object's internal properties.

Fixes #5814

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
John McLear 2026-04-05 00:25:20 +01:00 committed by GitHub
parent f7e4100aba
commit 4896b5286a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -125,6 +125,7 @@ class Pad {
authorId && authorManager.addPad(authorId, this.id),
hooks.aCallAll(hook, {
pad: this,
padId: this.id,
authorId,
get author() {
pad_utils.warnDeprecated(`${hook} hook author context is deprecated; use authorId instead`);