[15 minute fix] Remove secondary logo (#13595)
This commit is contained in:
parent
1868537294
commit
c5598816ac
12 changed files with 13 additions and 52 deletions
|
|
@ -163,10 +163,6 @@ module ApplicationHelper
|
|||
end
|
||||
end
|
||||
|
||||
def safe_logo_url(logo)
|
||||
logo.presence || SiteConfig.logo_png
|
||||
end
|
||||
|
||||
def community_name
|
||||
@community_name ||= Settings::Community.community_name
|
||||
end
|
||||
|
|
|
|||
|
|
@ -87,10 +87,6 @@ module Constants
|
|||
description: "Determines how often periodic email digests are sent",
|
||||
placeholder: 2
|
||||
},
|
||||
secondary_logo_url: {
|
||||
description: "A place for an alternate logo, if you have one. Used throughout member onboarding and in some sign in forms.",
|
||||
placeholder: IMAGE_PLACEHOLDER
|
||||
},
|
||||
shop_url: {
|
||||
description: "Used as the shop url of the community",
|
||||
placeholder: "https://shop.url"
|
||||
|
|
|
|||
|
|
@ -94,7 +94,6 @@ class SiteConfig < RailsSettings::Base
|
|||
validates: { url: true }
|
||||
|
||||
field :logo_svg, type: :string
|
||||
field :secondary_logo_url, type: :string, validates: { url: true }
|
||||
|
||||
field :enable_video_upload, type: :boolean, default: false
|
||||
|
||||
|
|
|
|||
|
|
@ -733,18 +733,6 @@
|
|||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="crayons-field">
|
||||
<%= admin_config_label :secondary_logo_url %>
|
||||
<%= admin_config_description Constants::SiteConfig::DETAILS[:secondary_logo_url][:description] %>
|
||||
<%= f.text_field :secondary_logo_url,
|
||||
class: "crayons-textfield",
|
||||
value: SiteConfig.secondary_logo_url,
|
||||
placeholder: Constants::SiteConfig::DETAILS[:secondary_logo_url][:placeholder] %>
|
||||
<% if SiteConfig.secondary_logo_url.present? %>
|
||||
<img alt="secondary logo image" class="img-fluid" src="<%= Images::Optimizer.call(SiteConfig.secondary_logo_url, width: 256) %>" width="128px" height="128px" />
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= render "form_submission", f: f %>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<div id="global-signup-modal" class="authentication-modal hidden">
|
||||
<div class="authentication-modal__container">
|
||||
<figure class="authentication-modal__image-container">
|
||||
<img class="authentication-modal__image" src="<%= optimized_image_url(safe_logo_url(SiteConfig.secondary_logo_url), width: 190) %>"
|
||||
<img class="authentication-modal__image" src="<%= optimized_image_url(SiteConfig.logo_png, width: 190) %>"
|
||||
alt="<%= community_name %>" />
|
||||
</figure>
|
||||
<div class="authentication-modal__content">
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
</button>
|
||||
|
||||
<div>
|
||||
<img alt="onboarding task card image" class="task-card-image" src="<%= safe_logo_url(SiteConfig.secondary_logo_url) %>" />
|
||||
<img alt="onboarding task card image" class="task-card-image" src="<%= SiteConfig.logo_png %>" />
|
||||
</div>
|
||||
|
||||
<h2 class="task-card-title" id="task-card-title">You're now a part of the community!</h2>
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
<div id="onboarding-container"
|
||||
data-community-name="<%= community_name %>"
|
||||
data-community-description="<%= Settings::Community.community_description %>"
|
||||
data-community-logo="<%= optimized_image_url(safe_logo_url(SiteConfig.secondary_logo_url)) %>"
|
||||
data-community-logo="<%= optimized_image_url(SiteConfig.logo_png) %>"
|
||||
data-community-background="<%= optimized_image_url(SiteConfig.onboarding_background_image, width: 1680, quality: 75, random_fallback: false) %>">
|
||||
<%= javascript_packs_with_chunks_tag "Onboarding", defer: true %>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<div class="authentication-feed__card" id="in-feed-cta">
|
||||
<div class="authentication-feed__container">
|
||||
<figure class="authentication-feed__image-container">
|
||||
<img class="authentication-feed__image" src="<%= optimized_image_url(safe_logo_url(SiteConfig.secondary_logo_url), width: 190) %>"
|
||||
<img class="authentication-feed__image" src="<%= optimized_image_url(SiteConfig.logo_png, width: 190) %>"
|
||||
alt="Secondary <%= community_name %> logo" />
|
||||
</figure>
|
||||
<div class="authentication-feed__content">
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
module DataUpdateScripts
|
||||
class RemoveSiteConfigSecondaryLogo
|
||||
def run
|
||||
SiteConfig.destroy_by(var: "secondary_logo_url")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -5,8 +5,7 @@ RSpec.describe SiteConfig, type: :model do
|
|||
describe "validating URLs" do
|
||||
let(:url_fields) do
|
||||
%w[
|
||||
main_social_image logo_png secondary_logo_url
|
||||
mascot_image_url mascot_footer_image_url onboarding_background_image
|
||||
main_social_image logo_png mascot_image_url mascot_footer_image_url onboarding_background_image
|
||||
]
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -386,28 +386,6 @@ RSpec.describe "/admin/customization/config", type: :request do
|
|||
expect(SiteConfig.logo_svg).to eq(expected_image_url)
|
||||
end
|
||||
|
||||
it "updates secondary_logo_url" do
|
||||
expected_image_url = "https://dummyimage.com/300x300.png"
|
||||
post admin_config_path, params: { site_config: { secondary_logo_url: expected_image_url },
|
||||
confirmation: confirmation_message }
|
||||
expect(SiteConfig.secondary_logo_url).to eq(expected_image_url)
|
||||
end
|
||||
|
||||
it "updates secondary_logo_url with a valid image" do
|
||||
expected_image = "https://dummyimage.com/300x300"
|
||||
post admin_config_path, params: { site_config: { secondary_logo_url: expected_image },
|
||||
confirmation: confirmation_message }
|
||||
expect(SiteConfig.secondary_logo_url).to eq(expected_image)
|
||||
end
|
||||
|
||||
it "only updates the secondary_logo_url if given a valid image URL" do
|
||||
invalid_image_url = "![logo_lowres]https://dummyimage.com/300x300.png"
|
||||
expect do
|
||||
post admin_config_path, params: { site_config: { secondary_logo_url: invalid_image_url },
|
||||
confirmation: confirmation_message }
|
||||
end.not_to change(SiteConfig, :secondary_logo_url)
|
||||
end
|
||||
|
||||
it "rejects update without proper confirmation" do
|
||||
expected_image_url = "https://dummyimage.com/300x300.png"
|
||||
expect do
|
||||
|
|
@ -897,7 +875,7 @@ RSpec.describe "/admin/customization/config", type: :request do
|
|||
it "does not update brand color if hex not contrasting enough" do
|
||||
hex = "#bd746f" # not dark enough
|
||||
post admin_config_path, params: { site_config: { primary_brand_color_hex: hex },
|
||||
confirmation: confirmation_message }
|
||||
confirmation: confirmation_message }
|
||||
expect(Settings::UserExperience.primary_brand_color_hex).not_to eq(hex)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -25,14 +25,12 @@ RSpec.describe "Onboardings", type: :request do
|
|||
end
|
||||
|
||||
it "contains proper data attribute values if the onboarding config is present" do
|
||||
allow(SiteConfig).to receive(:secondary_logo_url).and_return("whatevs.png")
|
||||
allow(SiteConfig).to receive(:onboarding_background_image).and_return("onboarding_background_image.png")
|
||||
|
||||
sign_in user
|
||||
get onboarding_url
|
||||
|
||||
expect(response.body).to include(Settings::Community.community_description)
|
||||
expect(response.body).to include(safe_logo_url(SiteConfig.secondary_logo_url))
|
||||
expect(response.body).to include(SiteConfig.onboarding_background_image)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue