]> git.openstreetmap.org Git - rails.git/commitdiff
Fix new rubocop warnings
authorTom Hughes <tom@compton.nu>
Mon, 16 May 2022 18:16:53 +0000 (19:16 +0100)
committerTom Hughes <tom@compton.nu>
Mon, 16 May 2022 18:16:53 +0000 (19:16 +0100)
.rubocop.yml
app/controllers/messages_controller.rb
app/controllers/sessions_controller.rb
app/controllers/users_controller.rb

index dc7590df36d3ee5353256fe2f308af287ae0443c..65db8a6a563522c536389729db7ec383aca9f0f6 100644 (file)
@@ -96,12 +96,6 @@ Style/MixinUsage:
     - 'bin/setup'
     - 'bin/update'
 
-Style/RedundantCondition:
-  Exclude:
-    - 'app/controllers/messages_controller.rb'
-    - 'app/controllers/sessions_controller.rb'
-    - 'app/controllers/users_controller.rb'
-
 Style/StringLiterals:
   EnforcedStyle: double_quotes
 
index e801915d6e03d9933cd30e919ca8a73237ab5566..cc311f93f9a67650d3e6577f77b29dfc77533dff 100644 (file)
@@ -121,11 +121,7 @@ class MessagesController < ApplicationController
 
       referer = safe_referer(params[:referer]) if params[:referer]
 
-      if referer
-        redirect_to referer
-      else
-        redirect_to :action => :inbox
-      end
+      redirect_to referer || { :action => :inbox }
     end
   rescue ActiveRecord::RecordNotFound
     @title = t "messages.no_such_message.title"
index 5b46d67d0bf78e733e5d50af9af8d2fbdfe8ce3d..9489553a81d438abfcc4620d8e8452cebfaa6d76 100644 (file)
@@ -38,11 +38,7 @@ class SessionsController < ApplicationController
 
       referer = safe_referer(params[:referer]) if params[:referer]
 
-      if referer
-        redirect_to referer
-      else
-        redirect_to :controller => "site", :action => "index"
-      end
+      redirect_to referer || { :controller => "site", :action => "index" }
     end
   end
 
index 3489b4eda9e290c039f8cb61e4117b93bd08c267..534f988104c85beb24a20a1b11a5eef466191b93 100644 (file)
@@ -136,11 +136,7 @@ class UsersController < ApplicationController
     if current_user
       # The user is logged in already, so don't show them the signup
       # page, instead send them to the home page
-      if @referer
-        redirect_to @referer
-      else
-        redirect_to :controller => "site", :action => "index"
-      end
+      redirect_to @referer || { :controller => "site", :action => "index" }
     elsif params.key?(:auth_provider) && params.key?(:auth_uid)
       self.current_user = User.new(:email => params[:email],
                                    :email_confirmation => params[:email],