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
This commit is contained in:
Julianna Tetreault 2022-01-10 10:30:05 -07:00 committed by GitHub
parent d140e43061
commit 0dfad5b07f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 3 additions and 80 deletions

View file

@ -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;
}

View file

@ -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

View file

@ -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

View file

@ -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),

View file

@ -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
</button>
</div>
<div
id="getStartedBodyContainer"
class="<%= VerifySetupCompleted.setup_completed? ? "hide collapse" : "show expand" %> p-3"
class="show expand p-3"
aria-labelledby="getStartedHeader">
<%= render partial: "forms/mandatory" %>
</div>

View file

@ -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 })

View file

@ -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