]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/reports_controller.rb
Only show the "too many messages" error once
[rails.git] / app / controllers / reports_controller.rb
index ef87a8699fe807884ec29d09d65a1064bf49a2fa..a04fab5b9ab36c87a19a442c07b277cc59c56250 100644 (file)
@@ -3,7 +3,8 @@ class ReportsController < ApplicationController
 
   before_action :authorize_web
   before_action :set_locale
-  before_action :require_user
+
+  authorize_resource
 
   def new
     if required_new_report_params_present?
@@ -51,12 +52,15 @@ class ReportsController < ApplicationController
 
   def default_assigned_role
     case issue_params[:reportable_type]
-    when "Note" then "moderator"
-    when "User" then case report_params[:category]
-                     when "vandal" then "moderator"
-                     else "administrator"
-                     end
-    else "administrator"
+    when "Note"
+      "moderator"
+    when "User"
+      case report_params[:category]
+      when "vandal" then "moderator"
+      else "administrator"
+      end
+    else
+      "administrator"
     end
   end
 end