8000 feat(builder): confirm before discarding all unpublished changes by Klehm · Pull Request #2 · Klehm/content-blocks-project · GitHub
[go: up one dir, main page]

Skip to content

feat(builder): confirm before discarding all unpublished changes - #2

Merged
Klehm merged 2 commits into
masterfrom
feat/discard-confirm
Jun 16, 2026
Merged

Klehm merged 2 commits into
masterfrom
feat/discard-confirm

Conversation

@Klehm
@Klehm Klehm commented Jun 16, 2026
Copy link
Copy Markdown
Owner

Quoi

Le bouton « Annuler les modifications » (Discard) jette toutes les modifications draft non publiées d'un coup, sans confirmation et de façon irréversible — bien plus destructeur qu'une suppression unitaire (qui a son propre snackbar Undo).

Cette PR ajoute une confirmation native avant l'action, calquée sur le flux « Insérer le contenu » (replace).

Détails

  • discard() affiche window.confirm(...) et s'interrompt si l'utilisateur refuse.
  • Texte localisé via une nouvelle clé cb.builder.discard_confirm (FR + EN), exposée au client sur l'attribut data-i18n de la racine du shell.
  • _t() lit désormais aussi la racine du shell, pour les chaînes de la topbar situées hors des pickers optionnels (replace / import-export).

Tests

  • Unit : confirmation demandée ; refus → aucun appel réseau ni reload ; texte localisé utilisé. Test existant publish and discard withdraw the pending offer mis à jour.
  • E2E : les flux discard existants acceptent le dialog ; nouveau test « refus → le draft est conservé ».
  • Suites complètes au vert (JS unit + PHP).

Note

Indépendante de #1 ; les deux branches touchent cb-builder_controller.js/cb-builder.test.js dans des régions disjointes et fusionnent sans conflit.

🤖 Generated with Claude Code

Klehm and others added 2 commits June 16, 2026 09:37
The Discard button threw away every unpublished draft edit at once with no
confirmation — far more destructive than a single delete (which has its own
Undo snackbar) and irreversible. Gate it behind a native confirm, mirroring
the "Insert content" replace flow.

The prompt text is localized via a new cb.builder.discard_confirm key
(FR + EN), exposed to the client on the shell root's data-i18n attribute;
_t() now also reads the shell root so topbar strings that live outside the
optional replace/import pickers resolve too.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The new discard confirmation also gates the discard click in
replace-content.spec.js; accept the dialog so the e2e flow proceeds.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Klehm
Klehm merged commit b0b0dd7 into master Jun 16, 2026
6 checks passed
@Klehm
Klehm deleted the feat/discard-confirm branch June 16, 2026 08:03
Klehm added a commit that referenced this pull request Jul 29, 2026
feat(builder): confirm before discarding all unpublished changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0