Save settings on key verification to prevent data loss
[MAILPOET-2991]
This commit is contained in:
@ -17,6 +17,7 @@ export default function KeyActivation() {
|
||||
const { notices } = useContext<any>(GlobalContext);
|
||||
const state = useSelector('getKeyActivationState')();
|
||||
const setState = useAction('updateKeyActivationState');
|
||||
const saveSettings = useAction('saveSettings');
|
||||
const verifyMssKey = useAction('verifyMssKey');
|
||||
const verifyPremiumKey = useAction('verifyPremiumKey');
|
||||
const installPremiumPlugin = useAction('installPremiumPlugin');
|
||||
@ -103,6 +104,7 @@ export default function KeyActivation() {
|
||||
});
|
||||
MailPoet.Modal.loading(true);
|
||||
setState({ inProgress: true });
|
||||
await saveSettings();
|
||||
await verifyMssKey(state.key);
|
||||
await sendCongratulatoryMssEmail();
|
||||
await verifyPremiumKey(state.key);
|
||||
|
@ -73,7 +73,11 @@ class Settings extends APIEndpoint {
|
||||
|
||||
$this->onSettingsChange($oldSettings, $this->settings->getAll());
|
||||
|
||||
// when pending approval, leave this to cron / Key Activation tab logic
|
||||
if (!$this->servicesChecker->isMailPoetAPIKeyPendingApproval()) {
|
||||
$this->bridge->onSettingsSave($settings);
|
||||
}
|
||||
|
||||
$this->authorizedEmailsController->onSettingsSave($settings);
|
||||
if ($signupConfirmation !== $this->settings->get('signup_confirmation.enabled')) {
|
||||
Form::updateSuccessMessages();
|
||||
|
@ -180,6 +180,7 @@ class AddSendingKeyCest {
|
||||
|
||||
// ensure status is running
|
||||
$i->amOnMailpoetPage('Help#/systemStatus');
|
||||
$i->scrollTo('.mailpoet-tab-content');
|
||||
$i->waitForText('Status running');
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ class SettingsTest extends \MailPoetTest {
|
||||
new Bridge,
|
||||
$this->make(AuthorizedEmailsController::class, ['onSettingsSave' => true ]),
|
||||
$this->make(TransactionalEmails::class),
|
||||
$this->make(ServicesChecker::class)
|
||||
$this->make(ServicesChecker::class, ['isMailPoetAPIKeyPendingApproval' => false])
|
||||
);
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ class SettingsTest extends \MailPoetTest {
|
||||
$this->make(Bridge::class, ['onSettingsSave' => Expected::once()]),
|
||||
$this->make(AuthorizedEmailsController::class, ['onSettingsSave' => Expected::once()]),
|
||||
$this->make(TransactionalEmails::class),
|
||||
$this->make(ServicesChecker::class)
|
||||
$this->make(ServicesChecker::class, ['isMailPoetAPIKeyPendingApproval' => false])
|
||||
);
|
||||
|
||||
$response = $this->endpoint->set(/* missing data */);
|
||||
|
Reference in New Issue
Block a user