]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/issues_controller.rb
Merge branch 'master' into moderation
[rails.git] / app / controllers / issues_controller.rb
index ffce14774b65fe2151db1055849669e386d23441..e3c844d45e703f59eee29300b70d5970e6610ac4 100644 (file)
@@ -60,8 +60,6 @@ class IssuesController < ApplicationController
     @unread_reports = @issue.unread_reports
     @comments = @issue.comments
     @related_issues = @issue.reported_user.issues.where(:issue_type => @user_role)
-
-    @updated_by_admin = User.find(@issue.updated_by) if @issue.updated_by
   end
 
   def new
@@ -105,10 +103,10 @@ class IssuesController < ApplicationController
           Notifier.new_issue_notification(@issue.id, User.find(user.user_id)).deliver_now
         end
 
-        redirect_back "/", :notice => t("issues.create.successful_report")
+        redirect_back :fallback_location => "/", :notice => t("issues.create.successful_report")
       end
     else
-      redirect_to new_issue_path(:reportable_type => @issue.reportable_type, :reportable_id => @issue.reportable_id, :reported_user_id => @issue.reported_user_id), :notice => t("issues.create.provide_details")
+      redirect_to new_issue_path(:reportable_type => @issue.reportable_type, :reportable_id => @issue.reportable_id), :notice => t("issues.create.provide_details")
     end
   end
 
@@ -139,10 +137,10 @@ class IssuesController < ApplicationController
       if @report.save!
         @issue.report_count = @issue.reports.count
         @issue.save!
-        redirect_back "/", :notice => notice
+        redirect_back :fallback_location => "/", :notice => notice
       end
     else
-      redirect_to new_issue_path(:reportable_type => @issue.reportable_type, :reportable_id => @issue.reportable_id, :reported_user_id => @issue.reported_user_id), :notice => t("issues.update.provide_details")
+      redirect_to new_issue_path(:reportable_type => @issue.reportable_type, :reportable_id => @issue.reportable_id), :notice => t("issues.update.provide_details")
     end
   end
 
@@ -249,11 +247,11 @@ class IssuesController < ApplicationController
   end
 
   def create_new_issue_params
-    params.permit(:reportable_id, :reportable_type, :reported_user_id)
+    params.permit(:reportable_id, :reportable_type)
   end
 
   def issue_params
-    params[:issue].permit(:reportable_id, :reportable_type, :reported_user_id)
+    params[:issue].permit(:reportable_id, :reportable_type)
   end
 
   def report_params
@@ -271,13 +269,4 @@ class IssuesController < ApplicationController
   def sort_direction
     %w[asc desc].include?(params[:direction]) ? params[:direction] : "asc"
   end
-
-  # back-port of ActionController#redirect_back from rails 5
-  def redirect_back(fallback_location, **args)
-    if referer = request.headers["Referer"]
-      redirect_to referer, **args
-    else
-      redirect_to fallback_location, **args
-    end
-  end
 end