]> git.openstreetmap.org Git - rails.git/commitdiff
Added description and author_id methods to Note
authorNenad Vujicic <nenadus@gmail.com>
Mon, 13 Jan 2025 09:21:56 +0000 (10:21 +0100)
committerNenad Vujicic <nenadus@gmail.com>
Tue, 14 Jan 2025 13:27:02 +0000 (14:27 +0100)
Added description and author_id (author_ip already exists) methods to Note model. They still use first comment (but will be soon replaced to use records from Note model).

app/models/note.rb

index 6d8ca078fa42e1d12e1652e3795a1e32caf02c26..d23f458e51f6ca80a7f6aea61363353ee7724fd9 100644 (file)
@@ -82,12 +82,22 @@ class Note < ApplicationRecord
     closed_at + DEFAULT_FRESHLY_CLOSED_LIMIT
   end
 
-  # Return the author object, derived from the first comment
+  # Return the note's description, derived from the first comment
+  def description
+    comments.first.body
+  end
+
+  # Return the note's author object, derived from the first comment
   def author
     comments.first.author
   end
 
-  # Return the author IP address, derived from the first comment
+  # Return the note's author ID, derived from the first comment
+  def author_id
+    comments.first.author_id
+  end
+
+  # Return the note's author IP address, derived from the first comment
   def author_ip
     comments.first.author_ip
   end