Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set UI key only when status transitioned to complete. #9090

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,9 @@ const baseActions = {

// If the onboarding state is complete, set the key in CORE_UI to trigger the notification.
if (
onboardingState !== currentOnboardingState &&
onboardingState ===
PUBLICATION_ONBOARDING_STATES.ONBOARDING_COMPLETE
PUBLICATION_ONBOARDING_STATES.ONBOARDING_COMPLETE
) {
registry
.dispatch( CORE_UI )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,52 @@ describe( 'modules/reader-revenue-manager publications', () => {
)
).toBe( true );
} );

it( 'should not set UI_KEY_SHOW_RRM_PUBLICATION_APPROVED_NOTIFICATION when publication status is already complete', async () => {
registry
.dispatch( MODULES_READER_REVENUE_MANAGER )
.receiveGetPublications( fixtures.publications );

const publication = fixtures.publications[ 3 ];

// Set the current settings.
const settings = {
publicationID: publication.publicationId,
publicationOnboardingState:
PUBLICATION_ONBOARDING_STATES.ONBOARDING_COMPLETE,
publicationOnboardingStateLastSyncedAtMs: 0,
};

fetchMock.postOnce( settingsEndpoint, {
body: settings,
status: 200,
} );

registry
.dispatch( MODULES_READER_REVENUE_MANAGER )
.receiveGetSettings( settings );

expect(
registry
.select( CORE_UI )
.getValue(
UI_KEY_READER_REVENUE_MANAGER_SHOW_PUBLICATION_APPROVED_NOTIFICATION
)
).toBeUndefined();

await registry
.dispatch( MODULES_READER_REVENUE_MANAGER )
.syncPublicationOnboardingState();

// Ensure that the UI key is not set.
expect(
registry
.select( CORE_UI )
.getValue(
UI_KEY_READER_REVENUE_MANAGER_SHOW_PUBLICATION_APPROVED_NOTIFICATION
)
).toBeUndefined();
} );
} );

describe( 'findMatchedPublication', () => {
Expand Down
Loading