mirror of
https://github.com/mastodon/mastodon.git
synced 2024-08-20 21:08:15 -07:00
Add redirect_with_vary
to AllowedMethods
for Style/FormatStringToken
cop (#28973)
This commit is contained in:
parent
86fbde7b46
commit
ce0d134147
2 changed files with 15 additions and 6 deletions
|
@ -174,6 +174,15 @@ Style/ClassAndModuleChildren:
|
||||||
Style/Documentation:
|
Style/Documentation:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
# Reason: Route redirects are not token-formatted and must be skipped
|
||||||
|
# https://docs.rubocop.org/rubocop/cops_style.html#styleformatstringtoken
|
||||||
|
Style/FormatStringToken:
|
||||||
|
inherit_mode:
|
||||||
|
merge:
|
||||||
|
- AllowedMethods # The rubocop-rails config adds `redirect`
|
||||||
|
AllowedMethods:
|
||||||
|
- redirect_with_vary
|
||||||
|
|
||||||
# Reason: Enforce modern Ruby style
|
# Reason: Enforce modern Ruby style
|
||||||
# https://docs.rubocop.org/rubocop/cops_style.html#stylehashsyntax
|
# https://docs.rubocop.org/rubocop/cops_style.html#stylehashsyntax
|
||||||
Style/HashSyntax:
|
Style/HashSyntax:
|
||||||
|
|
|
@ -104,12 +104,12 @@ Rails.application.routes.draw do
|
||||||
confirmations: 'auth/confirmations',
|
confirmations: 'auth/confirmations',
|
||||||
}
|
}
|
||||||
|
|
||||||
# rubocop:disable Style/FormatStringToken - those do not go through the usual formatting functions and are not safe to correct
|
with_options constraints: ->(req) { req.format.nil? || req.format.html? } do
|
||||||
get '/users/:username', to: redirect_with_vary('/@%{username}'), constraints: ->(req) { req.format.nil? || req.format.html? }
|
get '/users/:username', to: redirect_with_vary('/@%{username}')
|
||||||
get '/users/:username/following', to: redirect_with_vary('/@%{username}/following'), constraints: ->(req) { req.format.nil? || req.format.html? }
|
get '/users/:username/following', to: redirect_with_vary('/@%{username}/following')
|
||||||
get '/users/:username/followers', to: redirect_with_vary('/@%{username}/followers'), constraints: ->(req) { req.format.nil? || req.format.html? }
|
get '/users/:username/followers', to: redirect_with_vary('/@%{username}/followers')
|
||||||
get '/users/:username/statuses/:id', to: redirect_with_vary('/@%{username}/%{id}'), constraints: ->(req) { req.format.nil? || req.format.html? }
|
get '/users/:username/statuses/:id', to: redirect_with_vary('/@%{username}/%{id}')
|
||||||
# rubocop:enable Style/FormatStringToken
|
end
|
||||||
|
|
||||||
get '/authorize_follow', to: redirect { |_, request| "/authorize_interaction?#{request.params.to_query}" }
|
get '/authorize_follow', to: redirect { |_, request| "/authorize_interaction?#{request.params.to_query}" }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue