From 2e31b4ba02bdf4b41ee847eb42efd840d155058d Mon Sep 17 00:00:00 2001 From: Ridhwana Date: Thu, 11 Nov 2021 14:44:49 +0200 Subject: [PATCH] Redirect to creator settings page where necessary (#15298) * fix: closing divs and alignments * fix: closing divs, alignments and add z-elevate * refactor: remove the confirm email css annd add it to setup_mode * improve mobile responsiveness * feat: redirect directly to the new_admin_creator_setting_path from the confirmation email adn the signup * feat: update the test to no longer show the referral which seems no longer relevant * fix: update the tests to conform to the new URLS * update the link --- app/controllers/confirmations_controller.rb | 6 +++++- app/controllers/registrations_controller.rb | 6 +++++- .../creatorOnboardingFlows/creatorSettings.spec.js | 9 +++------ .../creatorOnboardingFlows/creatorSignup.spec.js | 5 +---- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/app/controllers/confirmations_controller.rb b/app/controllers/confirmations_controller.rb index b0a0f3b1b..74949d12a 100644 --- a/app/controllers/confirmations_controller.rb +++ b/app/controllers/confirmations_controller.rb @@ -11,7 +11,11 @@ class ConfirmationsController < Devise::ConfirmationsController set_flash_message!(:notice, :confirmed) if resource.creator? sign_in(resource) - redirect_to root_path + if FeatureFlag.enabled?(:creator_onboarding) + redirect_to new_admin_creator_setting_path + else + redirect_to root_path + end else respond_with_navigational(resource) { redirect_to after_confirmation_path_for(resource_name, resource) } end diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index 38655764b..f3d51b938 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -28,7 +28,11 @@ class RegistrationsController < Devise::RegistrationsController redirect_to confirm_email_path(email: resource.email) else sign_in(resource) - redirect_to root_path + if FeatureFlag.enabled?(:creator_onboarding) + redirect_to new_admin_creator_setting_path + else + redirect_to root_path + end end else render action: "by_email" diff --git a/cypress/integration/creatorOnboardingFlows/creatorSettings.spec.js b/cypress/integration/creatorOnboardingFlows/creatorSettings.spec.js index 164ae4388..e79e3b988 100644 --- a/cypress/integration/creatorOnboardingFlows/creatorSettings.spec.js +++ b/cypress/integration/creatorOnboardingFlows/creatorSettings.spec.js @@ -1,4 +1,4 @@ -describe('Creator Setup Page', () => { +describe('Creator Settings Page', () => { const { baseUrl } = Cypress.config(); beforeEach(() => { @@ -8,7 +8,7 @@ describe('Creator Setup Page', () => { cy.loginCreator(creator); }); - cy.visit(`${baseUrl}admin/creator_settings/new?referrer=${baseUrl}`); + cy.visit(`${baseUrl}admin/creator_settings/new`); }); it('should submit the creator settings form', () => { @@ -63,9 +63,6 @@ describe('Creator Setup Page', () => { cy.findByRole('button', { name: /logo/i }).should('have.attr', 'required'); // should not redirect the creator to the home page when the form is not completely filled out and 'Finish' is clicked cy.findByRole('button', { name: 'Finish' }).click(); - cy.url().should( - 'equal', - `${baseUrl}admin/creator_settings/new?referrer=${baseUrl}`, - ); + cy.url().should('equal', `${baseUrl}admin/creator_settings/new`); }); }); diff --git a/cypress/integration/creatorOnboardingFlows/creatorSignup.spec.js b/cypress/integration/creatorOnboardingFlows/creatorSignup.spec.js index f45e58288..1dcef095c 100644 --- a/cypress/integration/creatorOnboardingFlows/creatorSignup.spec.js +++ b/cypress/integration/creatorOnboardingFlows/creatorSignup.spec.js @@ -96,9 +96,6 @@ describe('Creator Signup Page', () => { .click(); const { baseUrl } = Cypress.config(); - cy.url().should( - 'equal', - `${baseUrl}admin/creator_settings/new?referrer=${baseUrl}`, - ); + cy.url().should('equal', `${baseUrl}admin/creator_settings/new`); }); });