about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorNick Schonning <nschonni@gmail.com>2023-02-08 01:07:36 -0500
committerGitHub <noreply@github.com>2023-02-08 07:07:36 +0100
commitf68bb52556fe90d7adad8db9ba8b801a22281f30 (patch)
treebbf7e121bf50760cec93afacff695f160a7f16d2 /app
parent8c1b65c7ddb9d49cb33c15c9a92dbfefebe868c6 (diff)
Apply Rubocop Style/NegatedIfElseCondition (#23451)
Diffstat (limited to 'app')
-rw-r--r--app/controllers/api/v1/streaming_controller.rb6
-rw-r--r--app/models/user.rb2
-rw-r--r--app/services/fetch_oembed_service.rb2
-rw-r--r--app/services/verify_link_service.rb2
4 files changed, 6 insertions, 6 deletions
diff --git a/app/controllers/api/v1/streaming_controller.rb b/app/controllers/api/v1/streaming_controller.rb
index 7cd60615a..b23a60170 100644
--- a/app/controllers/api/v1/streaming_controller.rb
+++ b/app/controllers/api/v1/streaming_controller.rb
@@ -2,10 +2,10 @@
 
 class Api::V1::StreamingController < Api::BaseController
   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
+    else
+      redirect_to streaming_api_url, status: 301
     end
   end
 
diff --git a/app/models/user.rb b/app/models/user.rb
index d40044da3..c767f8984 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -265,7 +265,7 @@ class User < ApplicationRecord
   end
 
   def inactive_message
-    !approved? ? :pending : super
+    approved? ? super : :pending
   end
 
   def approve!
diff --git a/app/services/fetch_oembed_service.rb b/app/services/fetch_oembed_service.rb
index 7d0879c79..9851ac098 100644
--- a/app/services/fetch_oembed_service.rb
+++ b/app/services/fetch_oembed_service.rb
@@ -82,7 +82,7 @@ class FetchOEmbedService
     return if @endpoint_url.blank?
 
     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
 
     validate(parse_for_format(body)) if body.present?
diff --git a/app/services/verify_link_service.rb b/app/services/verify_link_service.rb
index f83a664d4..707aeb4e0 100644
--- a/app/services/verify_link_service.rb
+++ b/app/services/verify_link_service.rb
@@ -19,7 +19,7 @@ class VerifyLinkService < BaseService
 
   def perform_request!
     @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