Browse Source

Apply Rubocop Style/NegatedIfElseCondition (#23451)

closed-social-glitch-2
Nick Schonning 1 year ago
committed by GitHub
parent
commit
f68bb52556
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 12 deletions
  1. +3
    -3
      app/controllers/api/v1/streaming_controller.rb
  2. +1
    -1
      app/models/user.rb
  3. +1
    -1
      app/services/fetch_oembed_service.rb
  4. +1
    -1
      app/services/verify_link_service.rb
  5. +6
    -6
      lib/tasks/mastodon.rake

+ 3
- 3
app/controllers/api/v1/streaming_controller.rb View File

@ -2,10 +2,10 @@
class Api::V1::StreamingController < Api::BaseController class Api::V1::StreamingController < Api::BaseController
def index def index
if Rails.configuration.x.streaming_api_base_url != request.host
redirect_to streaming_api_url, status: 301
else
if Rails.configuration.x.streaming_api_base_url == request.host
not_found not_found
else
redirect_to streaming_api_url, status: 301
end end
end end

+ 1
- 1
app/models/user.rb View File

@ -265,7 +265,7 @@ class User < ApplicationRecord
end end
def inactive_message def inactive_message
!approved? ? :pending : super
approved? ? super : :pending
end end
def approve! def approve!

+ 1
- 1
app/services/fetch_oembed_service.rb View File

@ -82,7 +82,7 @@ class FetchOEmbedService
return if @endpoint_url.blank? return if @endpoint_url.blank?
body = Request.new(:get, @endpoint_url).perform do |res| body = Request.new(:get, @endpoint_url).perform do |res|
res.code != 200 ? nil : res.body_with_limit
res.code == 200 ? res.body_with_limit : nil
end end
validate(parse_for_format(body)) if body.present? validate(parse_for_format(body)) if body.present?

+ 1
- 1
app/services/verify_link_service.rb View File

@ -19,7 +19,7 @@ class VerifyLinkService < BaseService
def perform_request! def perform_request!
@body = Request.new(:get, @url).add_headers('Accept' => 'text/html').perform do |res| @body = Request.new(:get, @url).add_headers('Accept' => 'text/html').perform do |res|
res.code != 200 ? nil : res.body_with_limit
res.code == 200 ? res.body_with_limit : nil
end end
end end

+ 6
- 6
lib/tasks/mastodon.rake View File

@ -463,10 +463,10 @@ namespace :mastodon do
prompt.say 'Running `RAILS_ENV=production rails db:setup` ...' prompt.say 'Running `RAILS_ENV=production rails db:setup` ...'
prompt.say "\n\n" prompt.say "\n\n"
if !system(env.transform_values(&:to_s).merge({ 'RAILS_ENV' => 'production', 'SAFETY_ASSURED' => '1' }), 'rails db:setup')
prompt.error 'That failed! Perhaps your configuration is not right'
else
if system(env.transform_values(&:to_s).merge({ 'RAILS_ENV' => 'production', 'SAFETY_ASSURED' => '1' }), 'rails db:setup')
prompt.ok 'Done!' prompt.ok 'Done!'
else
prompt.error 'That failed! Perhaps your configuration is not right'
end end
end end
@ -479,10 +479,10 @@ namespace :mastodon do
prompt.say 'Running `RAILS_ENV=production rails assets:precompile` ...' prompt.say 'Running `RAILS_ENV=production rails assets:precompile` ...'
prompt.say "\n\n" prompt.say "\n\n"
if !system(env.transform_values(&:to_s).merge({ 'RAILS_ENV' => 'production' }), 'rails assets:precompile')
prompt.error 'That failed! Maybe you need swap space?'
else
if system(env.transform_values(&:to_s).merge({ 'RAILS_ENV' => 'production' }), 'rails assets:precompile')
prompt.say 'Done!' prompt.say 'Done!'
else
prompt.error 'That failed! Maybe you need swap space?'
end end
end end
end end

Loading…
Cancel
Save