Remove harcoded shop strings (#7319)
This commit is contained in:
parent
db4c9ef4b2
commit
b830cdc5b8
4 changed files with 18 additions and 11 deletions
|
|
@ -44,9 +44,9 @@
|
|||
<%= inline_svg_tag("twemoji/tag.svg", aria: true, class: "crayons-icon crayons-icon--default", title: "Tags") %>
|
||||
Tags
|
||||
</a>
|
||||
|
||||
|
||||
<a href="javascript:void(0)" class="crayons-link crayons-link--secondary crayons-link--block crayons-link--block--indented fs-s" id="main-nav-more-trigger">More...</a>
|
||||
|
||||
|
||||
<div class="hidden" id="main-nav-more">
|
||||
<a href="/code-of-conduct" class="crayons-link crayons-link--block">
|
||||
<%= inline_svg_tag("twemoji/thumb-up.svg", aria: true, class: "crayons-icon crayons-icon--default", title: "Code of Conduct") %>
|
||||
|
|
@ -56,7 +56,7 @@
|
|||
<%= inline_svg_tag("twemoji/bulb.svg", aria: true, class: "crayons-icon crayons-icon--default", title: "FAQ") %>
|
||||
FAQ
|
||||
</a>
|
||||
<a href="https://shop.dev.to/" class="crayons-link crayons-link--block">
|
||||
<a href="<%= SiteConfig.shop_url %>" class="crayons-link crayons-link--block">
|
||||
<%= inline_svg_tag("twemoji/shopping.svg", aria: true, class: "crayons-icon crayons-icon--default", title: "Shop") %>
|
||||
<%= community_name %> Shop
|
||||
</a>
|
||||
|
|
|
|||
|
|
@ -320,7 +320,11 @@ Rails.application.routes.draw do
|
|||
post "articles/preview" => "articles#preview"
|
||||
post "comments/preview" => "comments#preview"
|
||||
get "/stories/warm_comments/:username/:slug" => "stories#warm_comments"
|
||||
get "/shop", to: redirect("https://shop.dev.to/")
|
||||
|
||||
# NOTE: can't remove the hardcoded URL here as SiteConfig is not available here, we should eventually
|
||||
# setup dynamic redirects, see <https://github.com/thepracticaldev/dev.to/issues/7267>
|
||||
get "/shop", to: redirect("https://shop.dev.to")
|
||||
|
||||
get "/mod" => "moderations#index", :as => :mod
|
||||
get "/mod/:tag" => "moderations#index"
|
||||
get "/page/crayons" => "pages#crayons"
|
||||
|
|
|
|||
|
|
@ -247,11 +247,13 @@ RSpec.describe "/internal/config", type: :request do
|
|||
describe "Shop" do
|
||||
it "rejects update to shop_url without proper confirmation" do
|
||||
expected_shop_url = "https://qshop.dev.to"
|
||||
expect { post "/internal/config", params: { site_config: { shop_url: expected_shop_url }, confirmation: "Incorrect confirmation" } }.to raise_error Pundit::NotAuthorizedError
|
||||
|
||||
expect do
|
||||
params = { site_config: { shop_url: expected_shop_url }, confirmation: "Incorrect confirmation" }
|
||||
post "/internal/config", params: params
|
||||
end.to raise_error(Pundit::NotAuthorizedError)
|
||||
|
||||
expect(SiteConfig.shop_url).not_to eq(expected_shop_url)
|
||||
get "/privacy"
|
||||
expect(response.body).not_to include(expected_shop_url)
|
||||
expect(response.body).to include("#{ApplicationConfig['COMMUNITY_NAME']} Shop")
|
||||
end
|
||||
|
||||
it "sets shop_url to nil" do
|
||||
|
|
|
|||
|
|
@ -32,9 +32,10 @@ RSpec.describe "all routes", type: :routing do
|
|||
context "when redirected routes" do
|
||||
include RSpec::Rails::RequestExampleGroup
|
||||
|
||||
it "redirects /shop to shop.dev.to" do
|
||||
get "/shop"
|
||||
expect(response).to redirect_to("https://shop.dev.to/")
|
||||
it "redirects /shop to the default shop_url" do
|
||||
get shop_path
|
||||
|
||||
expect(response).to redirect_to(SiteConfig.shop_url)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue