From 0dfad5b07fe4de411ad6e084e28480a80a534f86 Mon Sep 17 00:00:00 2001 From: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com> Date: Mon, 10 Jan 2022 10:30:05 -0700 Subject: [PATCH] Remove Setup Banner (VerifySetupCompleted) (#15969) * Remove all references to VerifySetupCompleted to remove setup banner * Removes setup banner-related specs * Adjusts the title in activateMissingKeysModal * Adds the show expand classes to getStartedBodyContainer in show.html.erb --- app/assets/stylesheets/setup-mode.scss | 7 --- app/controllers/application_controller.rb | 1 - .../concerns/verify_setup_completed.rb | 44 ------------------- .../admin/controllers/config_controller.js | 2 +- app/views/admin/settings/show.html.erb | 5 +-- .../creatorSettings.spec.js | 3 -- .../admin/admin_manages_configuration_spec.rb | 21 --------- 7 files changed, 3 insertions(+), 80 deletions(-) delete mode 100644 app/controllers/concerns/verify_setup_completed.rb diff --git a/app/assets/stylesheets/setup-mode.scss b/app/assets/stylesheets/setup-mode.scss index 0ede02ccf..41e26862a 100644 --- a/app/assets/stylesheets/setup-mode.scss +++ b/app/assets/stylesheets/setup-mode.scss @@ -21,10 +21,3 @@ body.default-header { [data-creator-settings-target='previewLogo'] { max-height: 80px; } - -// This ID is tied the global "Setup not complete" banner -// and is necessary for the removal of the banner on the -// Creator Settings page -#setup-banner { - display: none; -} diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 0e38c2ead..cacbfc047 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -12,7 +12,6 @@ class ApplicationController < ActionController::Base include Pundit include CachingHeaders include ImageUploads - include VerifySetupCompleted include DevelopmentDependencyChecks if Rails.env.development? include EdgeCacheSafetyCheck unless Rails.env.production? include Devise::Controllers::Rememberable diff --git a/app/controllers/concerns/verify_setup_completed.rb b/app/controllers/concerns/verify_setup_completed.rb deleted file mode 100644 index 756da0a62..000000000 --- a/app/controllers/concerns/verify_setup_completed.rb +++ /dev/null @@ -1,44 +0,0 @@ -# Included in the ApplicationController to assist with creator onboarding -module VerifySetupCompleted - extend ActiveSupport::Concern - - module_function - - included do - # rubocop:disable Rails/LexicallyScopedActionFilter - before_action :verify_setup_completed, only: %i[index new edit show] - # rubocop:enable Rails/LexicallyScopedActionFilter - end - - def setup_completed? - missing_configs.empty? - end - - def missing_configs - @missing_configs ||= Settings::Mandatory.missing - end - - private - - def missing_configs_text - display_missing = missing_configs.size > 3 ? missing_configs.first(3) + ["others"] : missing_configs - display_missing.map { |config| config.to_s.tr("_", " ") }.to_sentence - end - - def verify_setup_completed - # This is the only flash in our application layout, don't override it if - # there's already another message. - return if flash[:global_notice].present? - return if config_path? || setup_completed? || Settings::General.waiting_on_first_user - - link = helpers.tag.a("the configuration page", href: admin_config_path, data: { "no-instant" => true }) - - flash[:global_notice] = helpers.safe_join(["Setup not completed yet, missing ", - missing_configs_text, - ". Please visit ", link, "."]) - end - - def config_path? - request.env["PATH_INFO"] == admin_config_path - end -end diff --git a/app/javascript/admin/controllers/config_controller.js b/app/javascript/admin/controllers/config_controller.js index 06fdf317f..2f8f57e50 100644 --- a/app/javascript/admin/controllers/config_controller.js +++ b/app/javascript/admin/controllers/config_controller.js @@ -402,7 +402,7 @@ export default class ConfigController extends Controller { activateMissingKeysModal(providers) { this.configModalAnchorTarget.innerHTML = adminModal({ - title: 'Setup not complete', + title: 'Getting started', controllerName: 'config', closeModalFunction: 'closeAdminModal', body: this.missingAuthKeysModalBody(providers), diff --git a/app/views/admin/settings/show.html.erb b/app/views/admin/settings/show.html.erb index 538e89594..16c6656a6 100644 --- a/app/views/admin/settings/show.html.erb +++ b/app/views/admin/settings/show.html.erb @@ -23,14 +23,13 @@ class="crayons-btn crayons-btn--secondary float-right" type="button" data-action="click->config#toggleAccordionButtonLabel"> - - <%= VerifySetupCompleted.setup_completed? ? "Show Getting Started" : "Hide Getting Started" %> + Hide Getting Started
p-3" + class="show expand p-3" aria-labelledby="getStartedHeader"> <%= render partial: "forms/mandatory" %>
diff --git a/cypress/integration/creatorOnboardingFlows/creatorSettings.spec.js b/cypress/integration/creatorOnboardingFlows/creatorSettings.spec.js index c000f3bd6..5d9a85008 100644 --- a/cypress/integration/creatorOnboardingFlows/creatorSettings.spec.js +++ b/cypress/integration/creatorOnboardingFlows/creatorSettings.spec.js @@ -17,9 +17,6 @@ describe('Creator Settings Page', () => { cy.findByText('No stress, you can always change it later.').should( 'be.visible', ); - cy.findByText( - /Setup not completed yet, missing community description, suggested tags, and suggested users./i, - ).should('not.be.visible'); // should contain a community name and update the field properly cy.findByRole('textbox', { name: /community name/i }) diff --git a/spec/system/admin/admin_manages_configuration_spec.rb b/spec/system/admin/admin_manages_configuration_spec.rb index e2779cdc4..ba8b0f52d 100644 --- a/spec/system/admin/admin_manages_configuration_spec.rb +++ b/spec/system/admin/admin_manages_configuration_spec.rb @@ -14,25 +14,4 @@ RSpec.describe "Admin manages configuration", type: :system do expect(first(selector).text).to include("Required") end end - - context "when mandatory options are missing" do - it "does not show the banner on the config page" do - allow(Settings::Community).to receive(:tagline).and_return(nil) - expect(page).not_to have_content("Setup not completed yet") - end - - it "does show the banner on other pages" do - allow(Settings::Community).to receive(:tagline).and_return(nil) - visit root_path - expect(page).to have_content("Setup not completed yet") - end - - it "includes information about missing fields on the config pages" do - allow(Settings::Community).to receive(:tagline).and_return(nil) - allow(Settings::General).to receive(:suggested_users).and_return(nil) - allow(Settings::General).to receive(:suggested_tags).and_return(nil) - visit root_path - expect(page.body).to include("Setup not completed yet, missing suggested tags and suggested users.") - end - end end