From: Nenad Vujicic Date: Tue, 4 Feb 2025 15:36:58 +0000 (+0100) Subject: Switches from comments to all_comments X-Git-Tag: live~38^2~1 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/85bc737dee2523d0c880fc14280d2e1955cc447c?hp=361dcbb1dfd05c09034ed92da9bbf4305fcb8da9 Switches from comments to all_comments Switches from using note's .comments to .all_comments. Fixes bug with notes of deleted users without comments, which are filtered out, but the code tries to access the first comment. --- diff --git a/app/models/note.rb b/app/models/note.rb index d37b863e5..807ee9ec8 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -94,7 +94,7 @@ class Note < ApplicationRecord # Return the note's description, derived from the first comment def description if user_ip.nil? && user_id.nil? - comments.first.body + all_comments.first.body else RichText.new("text", super) end @@ -103,7 +103,7 @@ class Note < ApplicationRecord # Return the note's author object, derived from the first comment def author if user_ip.nil? && user_id.nil? - comments.first.author + all_comments.first.author else super end