From: Nenad Vujicic Date: Wed, 29 Jan 2025 12:31:19 +0000 (+0100) Subject: Removes optional using first comments records X-Git-Tag: live~45^2~2 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/c3e8a2efd2c9adfc767479112051435849328502?hp=--cc Removes optional using first comments records Removes optional using of note's first comments records for retrieving note's description and author in Note model file. --- c3e8a2efd2c9adfc767479112051435849328502 diff --git a/app/models/note.rb b/app/models/note.rb index 2ec72a03a..068efa59a 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -92,22 +92,9 @@ class Note < ApplicationRecord closed_at + DEFAULT_FRESHLY_CLOSED_LIMIT end - # Return the note's description, derived from the first comment + # Return the note's description def description - if user_ip.nil? && user_id.nil? - all_comments.first.body if all_comments.first&.event == "opened" - else - RichText.new("text", super) - end - end - - # Return the note's author object, derived from the first comment - def author - if user_ip.nil? && user_id.nil? - all_comments.first.author if all_comments.first&.event == "opened" - else - super - end + RichText.new("text", super) end private