diff options
Diffstat (limited to 'app/controllers/concerns')
-rw-r--r-- | app/controllers/concerns/rate_limit_headers.rb | 2 | ||||
-rw-r--r-- | app/controllers/concerns/signature_verification.rb | 4 | ||||
-rw-r--r-- | app/controllers/concerns/web_app_controller_concern.rb | 9 |
3 files changed, 5 insertions, 10 deletions
diff --git a/app/controllers/concerns/rate_limit_headers.rb b/app/controllers/concerns/rate_limit_headers.rb index 86fe58a71..b8696df73 100644 --- a/app/controllers/concerns/rate_limit_headers.rb +++ b/app/controllers/concerns/rate_limit_headers.rb @@ -58,7 +58,7 @@ module RateLimitHeaders end def api_throttle_data - most_limited_type, = request.env['rack.attack.throttle_data'].min_by { |_, v| v[:limit] - v[:count] } + most_limited_type, = request.env['rack.attack.throttle_data'].min_by { |_key, value| value[:limit] - value[:count] } request.env['rack.attack.throttle_data'][most_limited_type] end diff --git a/app/controllers/concerns/signature_verification.rb b/app/controllers/concerns/signature_verification.rb index 2394574b3..4502da698 100644 --- a/app/controllers/concerns/signature_verification.rb +++ b/app/controllers/concerns/signature_verification.rb @@ -28,8 +28,8 @@ module SignatureVerification end class SignatureParamsTransformer < Parslet::Transform - rule(params: subtree(:p)) do - (p.is_a?(Array) ? p : [p]).each_with_object({}) { |(key, val), h| h[key] = val } + rule(params: subtree(:param)) do + (param.is_a?(Array) ? param : [param]).each_with_object({}) { |(key, value), hash| hash[key] = value } end rule(param: { key: simple(:key), value: simple(:val) }) do diff --git a/app/controllers/concerns/web_app_controller_concern.rb b/app/controllers/concerns/web_app_controller_concern.rb index b6050c913..7ba7a57e3 100644 --- a/app/controllers/concerns/web_app_controller_concern.rb +++ b/app/controllers/concerns/web_app_controller_concern.rb @@ -4,22 +4,17 @@ module WebAppControllerConcern extend ActiveSupport::Concern included do + prepend_before_action :redirect_unauthenticated_to_permalinks! before_action :set_pack - before_action :redirect_unauthenticated_to_permalinks! before_action :set_app_body_class - before_action :set_referrer_policy_header end def set_app_body_class @body_classes = 'app-body' end - def set_referrer_policy_header - response.headers['Referrer-Policy'] = 'origin' - end - def redirect_unauthenticated_to_permalinks! - return if user_signed_in? + return if user_signed_in? # NOTE: Different from upstream because we allow moved users to log in redirect_path = PermalinkRedirector.new(request.path).redirect_path |