mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Shift legacy redirect further down routes to avoid stomping /enterprises/check_permalink
This commit is contained in:
@@ -241,7 +241,7 @@ module Admin
|
||||
# Overriding method on Spree's resource controller
|
||||
def location_after_save
|
||||
referer_path = OpenFoodNetwork::RefererParser::path(request.referer)
|
||||
refered_from_edit = referer_path == main_app.edit_admin_enterprise_path(@enterprise)
|
||||
refered_from_edit = referer_path =~ /\/edit$/
|
||||
if params[:enterprise].key?(:producer_properties_attributes) && !refered_from_edit
|
||||
main_app.admin_enterprises_path
|
||||
else
|
||||
|
||||
@@ -3,7 +3,6 @@ Openfoodnetwork::Application.routes.draw do
|
||||
|
||||
# Redirects from old URLs avoid server errors and helps search engines
|
||||
get "/enterprises", to: redirect("/")
|
||||
get "/enterprises/:permalink", to: redirect("/")
|
||||
get "/products", to: redirect("/")
|
||||
get "/t/products/:id", to: redirect("/")
|
||||
get "/about_us", to: redirect(ContentConfig.footer_about_url)
|
||||
@@ -55,6 +54,7 @@ Openfoodnetwork::Application.routes.draw do
|
||||
end
|
||||
end
|
||||
get '/:id/shop', to: 'enterprises#shop', as: 'enterprise_shop'
|
||||
get "/enterprises/:permalink", to: redirect("/") # Legacy enterprise URL
|
||||
|
||||
devise_for :enterprise, controllers: { confirmations: 'enterprise_confirmations' }
|
||||
|
||||
|
||||
@@ -78,6 +78,8 @@ feature %q{
|
||||
end
|
||||
|
||||
fill_in 'enterprise_name', :with => 'Eaterprises'
|
||||
fill_in 'enterprise_permalink', with: 'eaterprises-permalink'
|
||||
page.should have_selector '.available'
|
||||
choose 'Own'
|
||||
|
||||
within (".side_menu") { click_link "Users" }
|
||||
|
||||
Reference in New Issue
Block a user