diff --git a/CHANGELOG-DEV.md b/CHANGELOG-DEV.md index 6820eff59e..06f01a4165 100644 --- a/CHANGELOG-DEV.md +++ b/CHANGELOG-DEV.md @@ -12,3 +12,4 @@ HumHub Changelog (DEVELOP) - Enh #6031: On users list grid, show Auth mode badge only for sys admins - Enh #6035: Added Estonian language - Fix #5956: Display all newer comments after current comment +- Enh #6061: Administration: Add a confirmation on profile field delete button diff --git a/protected/humhub/compat/HForm.php b/protected/humhub/compat/HForm.php index 8428d65571..642b7c1a6d 100644 --- a/protected/humhub/compat/HForm.php +++ b/protected/humhub/compat/HForm.php @@ -195,9 +195,9 @@ class HForm extends \yii\base\Component { $output = ""; foreach ($buttons as $buttonName => $definition) { - $definition['isVisible'] = isset($definition['isVisible']) ? $definition['isVisible'] : true; - if ($definition['type'] == 'submit' && $definition['isVisible']) { - $output .= \yii\helpers\Html::submitButton($definition['label'], ['name' => $buttonName, 'class' => $definition['class'], 'data-ui-loader' => '']); + $isVisible = $definition['isVisible'] ?? true; + if ($definition['type'] == 'submit' && $isVisible) { + $output .= \yii\helpers\Html::submitButton($definition['label'], array_merge(['name' => $buttonName, 'class' => $definition['class'], 'data-ui-loader' => ''], $definition['options'] ?? [])); $output .= " "; } } diff --git a/protected/humhub/modules/admin/controllers/UserProfileController.php b/protected/humhub/modules/admin/controllers/UserProfileController.php index f9f2c9b87b..c8f5ad59a7 100644 --- a/protected/humhub/modules/admin/controllers/UserProfileController.php +++ b/protected/humhub/modules/admin/controllers/UserProfileController.php @@ -136,7 +136,8 @@ class UserProfileController extends Controller $definition['buttons']['delete'] = [ 'type' => 'submit', 'label' => Yii::t('AdminModule.user', 'Delete'), - 'class' => 'btn btn-danger pull-right' + 'class' => 'btn btn-danger pull-right', + 'options' => ['data-action-confirm' => ''], ]; } diff --git a/protected/humhub/modules/user/tests/codeception/acceptance/ProfileCest.php b/protected/humhub/modules/user/tests/codeception/acceptance/ProfileCest.php index a43bc2cdbf..51cd450de7 100644 --- a/protected/humhub/modules/user/tests/codeception/acceptance/ProfileCest.php +++ b/protected/humhub/modules/user/tests/codeception/acceptance/ProfileCest.php @@ -199,6 +199,8 @@ class ProfileCest $I->jsClick('.tab-pane.active tr[data-key=0] td:last-child a'); $I->waitForText('Edit profile field'); $I->click('Delete'); + $I->waitForText('Confirm'); + $I->click('Confirm'); $I->seeSuccess('Deleted'); } }