etherpad-lite/src/node/db
John McLear d5acbb31ae
fix: filter already-deleted sessions when deleting a group (#7435)
* fix: filter already-deleted sessions when deleting a group

deleteSession uses setSub(..., undefined) to remove session references
from group2sessions and author2sessions, but this can leave null entries
in the sessionIDs object. When deleteGroup later iterates Object.keys
of sessionIDs and calls deleteSession on each, it throws "sessionID
does not exist" for the already-deleted sessions.

Now deleteGroup filters out null/falsy session entries before attempting
to delete them.

Fixes: https://github.com/ether/etherpad-lite/issues/5798

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: add regression test for deleteGroup after deleteSession (#5798)

Creates a group, author, and session, then deletes the session first,
then deletes the group. Without the fix, deleteGroup would throw
"sessionID does not exist" when encountering the null session entry.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 07:13:46 +01:00
..
API.ts chore: moved first files to esm (#7061) 2025-08-04 19:59:28 +02:00
AuthorManager.ts Moved to ts (#6593) 2024-08-17 20:14:36 +02:00
DB.ts chore: migrated settings to esm6 (#7062) 2025-08-04 22:42:50 +02:00
GroupManager.ts fix: filter already-deleted sessions when deleting a group (#7435) 2026-04-03 07:13:46 +01:00
Pad.ts chore: migrated settings to esm6 (#7062) 2025-08-04 22:42:50 +02:00
PadManager.ts chore: migrated settings to esm6 (#7062) 2025-08-04 22:42:50 +02:00
ReadOnlyManager.ts chore: moved first files to esm (#7061) 2025-08-04 19:59:28 +02:00
SecurityManager.ts chore: migrated settings to esm6 (#7062) 2025-08-04 22:42:50 +02:00
SessionManager.ts chore: moved first files to esm (#7061) 2025-08-04 19:59:28 +02:00
SessionStore.ts chore: use express session upstream 2025-08-01 22:33:22 +02:00