Use `Rails.env.local?` shorthand method to check env (#27519)

This commit is contained in:
Matt Jankowski 2023-10-26 17:20:41 -04:00 committed by GitHub
parent 4aa05d45fc
commit 12550a6a28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -488,7 +488,7 @@ class User < ApplicationRecord
end
def validate_email_dns?
email_changed? && !external? && !(Rails.env.test? || Rails.env.development?)
email_changed? && !external? && !Rails.env.local? # rubocop:disable Rails/UnknownEnv
end
def validate_role_elevation

View File

@ -206,7 +206,7 @@ module Mastodon
# We use our own middleware for this
config.public_file_server.enabled = false
config.middleware.use PublicFileServerMiddleware if Rails.env.development? || Rails.env.test? || ENV['RAILS_SERVE_STATIC_FILES'] == 'true'
config.middleware.use PublicFileServerMiddleware if Rails.env.local? || ENV['RAILS_SERVE_STATIC_FILES'] == 'true' # rubocop:disable Rails/UnknownEnv
config.middleware.use Rack::Attack
config.middleware.use Mastodon::RackMiddleware