]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/report.rb
Merge remote-tracking branch 'upstream/pull/3573'
[rails.git] / app / models / report.rb
index 9afedb04ee29a68a0cabf434b549a22ff6dbd1f8..1475197fe34b8e87ab99c550f6d8efb3bdd7e245 100644 (file)
@@ -25,18 +25,19 @@ class Report < ApplicationRecord
   belongs_to :issue, :counter_cache => true
   belongs_to :user
 
-  validates :issue, :presence => true
-  validates :user, :presence => true
   validates :details, :presence => true, :characters => true
   validates :category, :presence => true
 
   def self.categories_for(reportable)
     case reportable.class.name
-    when "DiaryEntry" then %w[spam offensive threat other]
-    when "DiaryComment" then %w[spam offensive threat other]
+    when "DiaryEntry", "DiaryComment" then %w[spam offensive threat other]
     when "User" then %w[spam offensive threat vandal other]
     when "Note" then %w[spam personal abusive other]
     else %w[other]
     end
   end
+
+  def details
+    RichText.new("markdown", self[:details])
+  end
 end