From 79e184d8e8ec313c28dfe69ecdea34a363d851d6 Mon Sep 17 00:00:00 2001 From: Graeme Porteous Date: Tue, 26 Mar 2024 14:05:39 +0000 Subject: [PATCH] Remove routing filter Depends on https://github.com/mysociety/alaveteli/pull/8096 --- lib/alavetelitheme.rb | 2 -- lib/routingfilter.rb | 18 ------------------ 2 files changed, 20 deletions(-) delete mode 100644 lib/routingfilter.rb diff --git a/lib/alavetelitheme.rb b/lib/alavetelitheme.rb index 505c863c..8ffe3d1b 100644 --- a/lib/alavetelitheme.rb +++ b/lib/alavetelitheme.rb @@ -1,5 +1,3 @@ -require 'routingfilter' - class ActionController::Base before_action :set_whatdotheyknow_view_paths diff --git a/lib/routingfilter.rb b/lib/routingfilter.rb deleted file mode 100644 index 12013edc..00000000 --- a/lib/routingfilter.rb +++ /dev/null @@ -1,18 +0,0 @@ -require 'i18n' - -# Monkeypatch the default `locale` filter. Have tried coming up with -# a separate filter but due to the filter chaining order, can't find a -# way to override behaviour of the locale filter in a chain. - -module RoutingFilter - class Locale < Filter - def prepend_segment!(result, segment) - # override the method in RoutingFilter::Locale so that we - # don't prepend the locale for admin links - url = result.is_a?(Array) ? result.first : result - url.sub!(%r(^(http.?://[^/]*)?(.*))) { "#{$1}/#{segment}#{$2 == '/' ? '' : $2}" } if - !url.match(/^\/admin/) - end - end -end -