etherpad-lite/src/static/js
John McLear ce038b0b0f
fix(pad): keep token-less Delete pad reachable without pad-wide settings (#7959) (#7960)
* fix(pad): keep token-less Delete pad reachable without pad-wide settings (#7959)

The token-less "Delete pad" button (#delete-pad) was nested inside the
enablePadWideSettings-gated pad-settings section, so disabling pad-wide
settings removed the only way to delete a pad without a recovery token.
Combined with #7926 hiding the token disclosure when deletion needs no
token (e.g. allowPadDeletionByAllUsers), a user who was allowed to delete
could be left with no deletion UI at all.

Pad deletion is unrelated to pad-wide settings, so:

- Move #delete-pad out of the enablePadWideSettings block in pad.html; it
  is now always rendered and hidden by default.
- Add a canDeletePad clientVar (isCreator || allowPadDeletionByAllUsers)
  and drive the button's visibility from it in pad_editor.ts, mirroring the
  existing canDeleteWithoutToken handling for the token disclosure.

The two controls are now mutually coherent and neither depends on
enablePadWideSettings: the plain button shows when this session can delete
without a token, the recovery-token disclosure shows otherwise.

Tests:
- backend padDeletionUiPlacement.ts: #delete-pad is rendered with
  enablePadWideSettings both on and off (fails without the template move).
- backend socketio.ts: canDeletePad reflects the creator/allow-all matrix,
  including a non-creator who only gains it under allowPadDeletionByAllUsers.
- frontend pad_settings.spec.ts: asserts #delete-pad is no longer a
  descendant of #pad-settings-section.

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

* fix(pad): never let readonly sessions delete via token-less paths (#7959)

Qodo review of #7960: `canDeletePad` was `isCreator || allowPadDeletionByAllUsers`,
so under allowPadDeletionByAllUsers a readonly viewer received
canDeletePad=true and the relocated #delete-pad button unhid for them.
Worse, the server-side handlePadDelete `flagOk`/`creatorOk` branches never
checked session.readonly either, so a readonly-link holder could actually
delete the pad without a token — a data-loss hole that the new always-rendered
button would expose.

Exclude readonly sessions from both the clientVar and the server's token-less
authorization paths. A valid recovery token (tokenOk) stays a sufficient
credential regardless of session mode.

Test: socketio.ts asserts a readonly viewer gets canDeletePad=false and that a
token-less PAD_DELETE from a readonly session leaves the pad intact (red before
this change on the clientVar assertion).

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

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 15:18:23 +01:00
..
pluginfw Fix offline/air-gapped Docker boot: stop pnpm self-provisioning the pinned version (#7911) (#7918) 2026-06-09 09:31:00 +01:00
types security: allow integrator sessionID cookie to be HttpOnly (#7045) (#7755) 2026-05-15 19:44:55 +01:00
vendors timeslider: respect showAuthorshipColors and padFontFamily settings (#7899) 2026-06-05 13:39:41 +01:00
ace.ts fix(a11y): drop role=textbox / aria-multiline from innerdocbody (#7778) (#7782) 2026-05-16 18:35:32 +01:00
ace2_common.ts Moved to ts (#6593) 2024-08-17 20:14:36 +02:00
ace2_inner.ts fix: RTL content option no longer flips the whole page (#7900) (#7901) 2026-06-05 13:24:26 +01:00
AttributeManager.ts Feat/changeset ts (#6594) 2024-08-18 12:14:24 +02:00
AttributeMap.ts Moved to ts (#6593) 2024-08-17 20:14:36 +02:00
AttributePool.ts Moved to ts (#6593) 2024-08-17 20:14:36 +02:00
attributes.ts Moved to ts (#6593) 2024-08-17 20:14:36 +02:00
basic_error_handler.ts Moved to ts (#6593) 2024-08-17 20:14:36 +02:00
broadcast.ts timeslider: respect showAuthorshipColors and padFontFamily settings (#7899) 2026-06-05 13:39:41 +01:00
broadcast_revisions.ts Moved to ts (#6593) 2024-08-17 20:14:36 +02:00
broadcast_slider.ts feat: add timeslider playback speed setting (#7541) 2026-04-19 09:08:37 +01:00
Builder.ts Feat/changeset ts (#6594) 2024-08-18 12:14:24 +02:00
caretPosition.ts Feat/bundle js (#6511) 2024-07-18 08:51:30 +02:00
Changeset.ts build(deps): bump jose from 5.10.0 to 6.0.12 (#7049) 2025-08-04 19:21:59 +02:00
changesettracker.ts Fixed document not accessible in iframe (#6642) 2024-09-09 11:26:12 +02:00
ChangesetUtils.ts Feat/changeset ts (#6594) 2024-08-18 12:14:24 +02:00
chat.ts feat(pad): scrub history in-place on the pad URL (#7659) (#7710) 2026-05-10 16:21:56 +01:00
ChatMessage.ts Moved to ts (#6593) 2024-08-17 20:14:36 +02:00
collab_client.ts fix(editor): tag inserts with clientVars author until userAuthor propagates (Firefox authorship flake) (#7910) 2026-06-08 20:41:13 +01:00
colorutils.ts fix(colors): pick WCAG-higher-contrast text for author colors (#7565) 2026-05-03 12:56:30 +08:00
contentcollector.ts fix(editor): preserve U+00A0 non-breaking space (#3037) (#7585) 2026-04-23 08:57:30 +01:00
cssmanager.ts Moved to ts (#6593) 2024-08-17 20:14:36 +02:00
domline.ts security: escape and integer-coerce numbered-list start attribute (GHSA-f7h5-v9hm-548j) (#7937) 2026-06-10 09:53:26 +01:00
index.ts Fixed index html page 2024-07-23 18:14:49 +02:00
l10n.ts feat: make cookie names configurable with prefix setting (#7450) 2026-04-05 01:58:29 +01:00
linestylefilter.ts Feat/changeset ts (#6594) 2024-08-18 12:14:24 +02:00
MergingOpAssembler.ts Feat/changeset ts (#6594) 2024-08-18 12:14:24 +02:00
Op.ts Feat/changeset ts (#6594) 2024-08-18 12:14:24 +02:00
OpAssembler.ts Feat/changeset ts (#6594) 2024-08-18 12:14:24 +02:00
OpIter.ts Feat/changeset ts (#6594) 2024-08-18 12:14:24 +02:00
pad.ts fix(pad): show detected language in settings dropdown (#7925) (#7928) 2026-06-09 15:23:01 +01:00
pad_automatic_reconnect.ts Moved to ts (#6593) 2024-08-17 20:14:36 +02:00
pad_connectionstatus.ts Moved to ts (#6593) 2024-08-17 20:14:36 +02:00
pad_cookie.ts feat: make cookie names configurable with prefix setting (#7450) 2026-04-05 01:58:29 +01:00
pad_editbar.ts fix(a11y): name role=toolbar regions, hide linemetricsdiv from AT (#7255) (#7777) 2026-05-16 13:08:33 +01:00
pad_editor.ts fix(pad): keep token-less Delete pad reachable without pad-wide settings (#7959) (#7960) 2026-06-17 15:18:23 +01:00
pad_impexp.ts feat(export): native DOCX export via html-to-docx (opt-in) (#7568) 2026-05-08 18:33:50 +01:00
pad_modals.ts Moved to ts (#6593) 2024-08-17 20:14:36 +02:00
pad_mode.ts fix(pad): show saved-revision markers in in-pad history mode (#7946) (#7948) 2026-06-12 12:12:36 +01:00
pad_outdated_notice.ts fix(pad): redesign outdated-version notice (#7799) (#7804) 2026-05-18 12:23:40 +01:00
pad_savedrevs.ts Moved to ts (#6593) 2024-08-17 20:14:36 +02:00
pad_userlist.ts fix: URL-encode pad names in admin 'Open' button and recent pads (#7865) (#7895) 2026-06-05 14:02:35 +01:00
pad_utils.ts Hardening: API request handling, random IDs, and plugin loading (#7906) 2026-06-07 19:17:39 +02:00
privacy_banner.ts feat(gdpr): configurable privacy banner (PR4 of #6701) (#7549) 2026-05-03 13:59:38 +08:00
rjquery.ts Moved to ts (#6593) 2024-08-17 20:14:36 +02:00
scroll.ts feat: continued with pad link functionality 2025-08-01 21:42:05 +02:00
security.ts Moved to ts (#6593) 2024-08-17 20:14:36 +02:00
skin_toolbar_colors.ts fix(7606): sync theme-color meta with client-side dark-mode switch (#7690) 2026-05-07 10:43:29 +01:00
skin_variants.ts fix(theme-color): dark address bar + no light-flash on dark-OS load (#7606) (#7909) 2026-06-08 21:54:08 +02:00
skiplist.ts Moved to ts (#6593) 2024-08-17 20:14:36 +02:00
SmartOpAssembler.ts Feat/changeset ts (#6594) 2024-08-18 12:14:24 +02:00
socketio.ts fix(socket.io): readd long polling 2025-03-13 14:32:00 +01:00
stampAuthorOnInserts.ts fix(editor): tag inserts with clientVars author until userAuthor propagates (Firefox authorship flake) (#7910) 2026-06-08 20:41:13 +01:00
StringAssembler.ts Feat/changeset ts (#6594) 2024-08-18 12:14:24 +02:00
StringIterator.ts Feat/changeset ts (#6594) 2024-08-18 12:14:24 +02:00
TextLinesMutator.ts Feat/changeset ts (#6594) 2024-08-18 12:14:24 +02:00
timeslider.ts timeslider: respect showAuthorshipColors and padFontFamily settings (#7899) 2026-06-05 13:39:41 +01:00
underscore.ts Moved to ts (#6593) 2024-08-17 20:14:36 +02:00
undomodule.ts fix: allow undo of clear authorship colors without disconnect (#7430) 2026-04-19 09:09:03 +01:00
welcome.ts feat(gdpr): HttpOnly author-token cookie (PR3 of #6701) (#7548) 2026-05-03 05:56:56 +01:00