]> git.openstreetmap.org Git - rails.git/commitdiff
Add database checks to issue and report controllers
authorTom Hughes <tom@compton.nu>
Sat, 7 Jan 2023 15:20:22 +0000 (15:20 +0000)
committerTom Hughes <tom@compton.nu>
Wed, 11 Jan 2023 11:12:36 +0000 (11:12 +0000)
Fixes #3875

app/controllers/issue_comments_controller.rb
app/controllers/issues_controller.rb
app/controllers/reports_controller.rb

index 7b935665f5bd4b1e86c3bc1e2a5ee6966eec3dbb..7edef184e782cf560a5c31d5a68b9c1550f1b88c 100644 (file)
@@ -3,9 +3,12 @@ class IssueCommentsController < ApplicationController
 
   before_action :authorize_web
   before_action :set_locale
+  before_action :check_database_readable
 
   authorize_resource
 
+  before_action :check_database_writable, :only => [:create]
+
   def create
     @issue = Issue.find(params[:issue_id])
     comment = @issue.comments.build(issue_comment_params)
index 10a6dc09ba603203fb43293a7b32a7dd0c8fd09f..b253ec5e1510f8db162513a363815532c301f1e3 100644 (file)
@@ -3,10 +3,12 @@ class IssuesController < ApplicationController
 
   before_action :authorize_web
   before_action :set_locale
+  before_action :check_database_readable
 
   authorize_resource
 
   before_action :find_issue, :only => [:show, :resolve, :reopen, :ignore]
+  before_action :check_database_writable, :only => [:resolve, :ignore, :reopen]
 
   def index
     @title = t ".title"
index 6d05e6a57b7f24042ffcb781e8952cbeb7f52bd5..5c70d970408f595411fd70c097c8c389ddd7e933 100644 (file)
@@ -3,9 +3,12 @@ class ReportsController < ApplicationController
 
   before_action :authorize_web
   before_action :set_locale
+  before_action :check_database_readable
 
   authorize_resource
 
+  before_action :check_database_writable, :only => [:new, :create]
+
   def new
     if required_new_report_params_present?
       @report = Report.new