[openstreetmap/openstreetmap-website] Adds description and author_id methods to Note (PR #5494)

Nenad Vujicic notifications at github.com
Tue Jan 14 20:49:04 UTC 2025


@nenad-vujicic commented on this pull request.



> @@ -36,6 +36,26 @@ class NoteComment < ApplicationRecord
   validates :event, :inclusion => %w[opened closed reopened commented hidden]
   validates :body, :length => { :maximum => 2000 }, :characters => true
 
+  # Return the note's description for first special comment (event is "opened")
+  # otherwise return the comment text
+  def tmp_body

I was trying to improve 'direct' access to comment's body / author (where first comment is accessed), so when we do data-migration it selects note's description / author (for first special comment) if migration is performed, otherwise, if migration is not done, selects comment's body / author.

Another reason is to hide logic (and don't do unwrapping of if-statements) from .(j)builder / _comment.html.erb / .. files where first comments are also accessed (mentioned [here](https://github.com/openstreetmap/openstreetmap-website/pull/5485#discussion_r1912484985)).

Perhaps we can find some better name or remove if really not necessary?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5494#discussion_r1915580473
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/5494/review/2550987304 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250114/75e925be/attachment.htm>


More information about the rails-dev mailing list