Repository navigation
Simplify the template add-on step into one action - #3663
Conversation
- Title names the add-on ("This template needs Geolocation") or the count.
- Replace the Add-on/Status/Action table with a short list: name, status
tag and the add-on's description from the add-ons API.
- One primary button ("Install and use template") installs or activates
every add-on in turn, then creates the form; per-row buttons are gone.
- Rows show Installing/Activating, Ready or Failed with the reason;
"Try again" retries only what failed. Cancel stays visible, disabled.
- Users who can't install see the reason and a "Go to add-ons" button.
- 500px dialog, buttons on the right, grey hover square on the close X.
- Include the add-on excerpt as "description" in the dependency response.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
|
|
Overall Grade |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| PHP | Nov 4, 2026 7:42a.m. | Review ↗ | |
| JavaScript | Nov 4, 2026 7:42a.m. | Review ↗ |
Important
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
There was a problem hiding this comment.
The new dialog renders cleanly, but closing it mid-install doesn't cancel anything. One blocking issue.
Live check (Playground, Lite on this PR, Pro installed). I opened the dialog through the real installNewForm path with a mocked missing_addons response of two add-ons (one not installed, one inactive). The 500px dialog, the title "This template needs 2 add-ons", the status tags, the descriptions and the "Install both and use template" button all render as the PR describes. Clicking the button shows "Installing…" and the Cancel button goes disabled.
Blocking: the close X still works during the install, and the import runs anyway. I clicked the X while the first add-on was installing. The dialog closed, but both add-on requests still went out and the template import request was sent again after they finished (import calls went from 1 to 2). The user chose to close, and the site still gets add-ons installed and a form created. See inline comment for the fix.
Non-blocking (read from source, not exercised):
- When the list mixes installable and manual add-ons (no
action), the button only mentions the installable ones andonImport()runs once those succeed, so the template import proceeds without the manual add-on. The old Continue button behaved the same way, but the new copy ("We'll set them up, then create your form") promises more. - This PR targets
fix/3485-template-addon-dependencies, notmaster, so it will only land once #3657 does.
Not exercised: the Failed / "Try again" path, the "Go to add-ons" no-permission variant, and real add-on installs (the install and activate responses were mocked). PR CI shows lint, PHPCS, PHPStan and PHPUnit as skipped on this head.
|
|
||
| primaryButton.textContent = __( 'Creating form…', 'formidable' ); | ||
| closeButton.click(); | ||
| onImport(); |
There was a problem hiding this comment.
Blocking. The loop above is not tied to the dialog's lifetime. If the user closes the dialog with the X (or Esc / overlay click) while a row is installing, this handler keeps running and still reaches onImport() here, which re-sends the template import. Repro: open the dialog, click the primary button, click the X while "Installing…" shows; both add-on requests complete and installNewForm runs again.
Fix: track whether the dialog was dismissed and bail out of the loop and this call. For example:
let dismissed = false;
modal.addEventListener( 'dialogclose', () => { dismissed = true; } ); // jQuery UI dialog event, or listen on the .dismiss click
...
for ( const row of pending.filter( item => ! item.done ) ) {
if ( dismissed ) {
return;
}
if ( ! await row.activate() ) {
failed = true;
}
}
if ( dismissed ) {
return;
}Alternatively keep the dialog open and ignore dismissal until the loop finishes (disable the X and block Esc like the Cancel button is), so the current behavior becomes consistent. Either way, the already-installed add-ons can stay installed; only the import must not fire after a dismiss. Check how this dialog is opened in js/admin/dom.js (makeModalIntoADialogAndOpen) for the right close event.
425e011
into
fix/3485-template-addon-dependencies
Follow-up to #3657.
Templates need at most 2 add-ons (29 of 414 need two), so the list never gets long.
🤖 Generated with Claude Code