Fix #4971: NoMethodError when trying to display some modreports.
Delete modreports for hard-deleted comments. There were a total of six invalid modreports for deleted comments.
This commit is contained in:
14
script/fixes/096_delete_invalid_moderation_reports.rb
Executable file
14
script/fixes/096_delete_invalid_moderation_reports.rb
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require_relative "base"
|
||||
|
||||
with_confirmation do
|
||||
CurrentUser.scoped(User.system) do
|
||||
ModerationReport.find_each do |report|
|
||||
if report.invalid? && report.errors[:model] == ["must exist"]
|
||||
puts "destroying modreport ##{report.id}"
|
||||
report.destroy!
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user