From 85bc737dee2523d0c880fc14280d2e1955cc447c Mon Sep 17 00:00:00 2001 From: Nenad Vujicic Date: Tue, 4 Feb 2025 16:36:58 +0100 Subject: [PATCH 1/1] 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. --- app/models/note.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 -- 2.39.5