Fix the issue with verifyMssKey overriding is_approved
The verifyMssKey side effect handler was overriding the value of is_approved when updating the state. [MAILPOET-4633]
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
import { cloneDeep, set } from 'lodash';
|
||||
import { select } from '@wordpress/data';
|
||||
|
||||
import { MailPoet } from 'mailpoet';
|
||||
@ -19,6 +20,7 @@ export function* verifyMssKey(key: string) {
|
||||
action: 'checkMSSKey',
|
||||
data: { key },
|
||||
};
|
||||
|
||||
if (!success) {
|
||||
return updateKeyActivationState({
|
||||
mssStatus: MssStatus.INVALID,
|
||||
@ -34,9 +36,20 @@ export function* verifyMssKey(key: string) {
|
||||
return updateKeyActivationState(fields);
|
||||
}
|
||||
|
||||
const data = select(STORE_NAME).getSettings();
|
||||
const data = cloneDeep(select(STORE_NAME).getSettings());
|
||||
|
||||
data.mta_group = 'mailpoet';
|
||||
data.mta = { ...data.mta, method: 'MailPoet', mailpoet_api_key: key };
|
||||
data.mta = {
|
||||
...data.mta,
|
||||
method: 'MailPoet',
|
||||
mailpoet_api_key: key,
|
||||
};
|
||||
|
||||
data.mta = set(
|
||||
data.mta,
|
||||
'mailpoet_api_key_state.data.is_approved',
|
||||
res.data.result.data.is_approved,
|
||||
);
|
||||
data.signup_confirmation.enabled = '1';
|
||||
|
||||
const call = yield {
|
||||
|
@ -92,7 +92,15 @@ export type Settings = {
|
||||
| 'already_used'
|
||||
| 'check_error'
|
||||
| 'valid_underprivileged';
|
||||
data: Record<string, unknown>;
|
||||
data: Record<string, unknown> & {
|
||||
subscriber_limit: number;
|
||||
email_volume_limit: number;
|
||||
emails_sent: number;
|
||||
public_id: string;
|
||||
support_tier: string;
|
||||
site_active_subscriber_limit: number;
|
||||
is_approved: boolean;
|
||||
};
|
||||
code: number;
|
||||
};
|
||||
};
|
||||
|
@ -126,7 +126,7 @@ class Services extends APIEndpoint {
|
||||
}
|
||||
|
||||
if ($successMessage) {
|
||||
return $this->successResponse(['message' => $successMessage, 'state' => $state]);
|
||||
return $this->successResponse(['message' => $successMessage, 'state' => $state, 'result' => $result]);
|
||||
}
|
||||
|
||||
switch ($state) {
|
||||
|
Reference in New Issue
Block a user