]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/note.rb
Merge branch 'master' into notes
[rails.git] / app / models / note.rb
index c32b1679b07b593f1dab2c8e9045e48cb1796e71..bb56c5ce0d6e73612b3358b1bdf9cc84226cc0b3 100644 (file)
@@ -39,7 +39,7 @@ class Note < ActiveRecord::Base
       resp += (comment_no == 1 ? "" : separator_char)
       resp += comment.body if comment.body
       resp += " [ " 
-      resp += comment.author_name if comment.author_name
+      resp += comment.author.display_name if comment.author
       resp += " " + comment.created_at.to_s + " ]"
       comment_no += 1
     end
@@ -49,7 +49,12 @@ class Note < ActiveRecord::Base
 
   # Check if a note is visible
   def visible?
-    return status != "hidden"
+    status != "hidden"
+  end
+
+  # Check if a note is closed
+  def closed?
+    not closed_at.nil?
   end
 
   # Return the author object, derived from the first comment
@@ -62,16 +67,6 @@ class Note < ActiveRecord::Base
     self.comments.first.author_ip
   end
 
-  # Return the author id, derived from the first comment
-  def author_id
-    self.comments.first.author_id
-  end
-
-  # Return the author name, derived from the first comment
-  def author_name
-    self.comments.first.author_name
-  end
-
 private
 
   # Fill in default values for new notes