Skip to content

Commit

Permalink
[BUGFIX] Repair installtool core updater button callback
Browse files Browse the repository at this point in the history
Button data attributes have been removed from th modal API
and are therefore not automatically assigned.
Instead of an initial and explicit data-action attribute,
we rather imply that the initial intention of the
"Check for core updates" is to check for updates,
and therefore use data-action only for subsequent actions.

Resolves: #100865
Releases: main, 12.4
Change-Id: Iac6138619012dd7f4a340fb4f773b7bbaf543583
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/79802
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: core-ci <typo3@b13.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
  • Loading branch information
bnf authored and lolli42 committed Jul 28, 2023
1 parent 80e86a2 commit fdbd39a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
12 changes: 6 additions & 6 deletions Build/Sources/TypeScript/install/module/upgrade/core-update.ts
Expand Up @@ -90,15 +90,15 @@ class CoreUpdate extends AbstractInteractableModule {

currentModal.on('click', '.t3js-coreUpdate-init', (e: JQueryEventObject): void => {
e.preventDefault();
// Don't use jQuery's data() function, as the DOM is re-rendered and any set data attribute gets lost.
// See showActionButton()
const action = $(e.currentTarget).attr('data-action');

if (!e.currentTarget.hasAttribute('data-action')) {
this.callAction('coreUpdateIsUpdateAvailable');
return;
}

const action = (e.currentTarget as HTMLElement).dataset.action;
this.findInModal(this.selectorOutput).empty();
switch (action) {
case 'checkForUpdate':
this.callAction('coreUpdateIsUpdateAvailable');
break;
case 'updateDevelopment':
this.update('development');
break;
Expand Down
3 changes: 0 additions & 3 deletions typo3/sysext/install/Classes/Controller/UpgradeController.php
Expand Up @@ -276,9 +276,6 @@ public function coreUpdateGetDataAction(ServerRequestInterface $request): Respon
'btnClass' => 'btn-warning t3js-coreUpdate-button t3js-coreUpdate-init',
'name' => 'coreUpdateCheckForUpdate',
'text' => 'Check for core updates',
'dataAttributes' => [
'action' => 'checkForUpdate',
],
];
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fdbd39a

Please sign in to comment.