From 9ed8a4333445443252b7ad47ba458a38fca4b785 Mon Sep 17 00:00:00 2001 From: Pablo Brasero Date: Thu, 30 Jul 2026 12:47:51 +0100 Subject: [PATCH] Render diary_comment using the record directly --- app/models/user_notifications.rb | 19 --------------- .../notifications/_diary_comment.html.erb | 24 +++++++++---------- 2 files changed, 12 insertions(+), 31 deletions(-) diff --git a/app/models/user_notifications.rb b/app/models/user_notifications.rb index 2d6fee0b3..dad2a522a 100644 --- a/app/models/user_notifications.rb +++ b/app/models/user_notifications.rb @@ -28,25 +28,6 @@ class UserNotifications end class DiaryCommentNotification < Notification - delegate :body, :to => :record - delegate :diary_entry, :to => :record - delegate :title, :to => :diary_entry, :prefix => true - - def commenter - record.user - end - - def comment_id - record.id - end - - def comment_body - record.body - end - - def diary_author - diary_entry.user - end end class GpxImportFailureNotification < Notification diff --git a/app/views/notifications/_diary_comment.html.erb b/app/views/notifications/_diary_comment.html.erb index 2866f7f2e..be82bc290 100644 --- a/app/views/notifications/_diary_comment.html.erb +++ b/app/views/notifications/_diary_comment.html.erb @@ -6,20 +6,20 @@ <%= link_to( t(".headline"), diary_entry_path( - notification.diary_author, - notification.diary_entry, - :anchor => "c#{notification.comment_id}" + record.diary_entry.user, + record.diary_entry, + :anchor => "c#{record.id}" ) ) %> -

<%= friendly_date_ago(notification.timestamp) %>

+

<%= friendly_date_ago(record.created_at) %>

<%= link_to( - user_thumbnail(notification.commenter, :class => "img-fluid"), - user_url(notification.commenter), + user_thumbnail(record.user, :class => "img-fluid"), + user_url(record.user), :target => "_blank", :rel => "noopener" ) %>
@@ -28,20 +28,20 @@ <%= t( ".description_html", :commenter_name_with_link => link_to( - notification.commenter.display_name, - notification.commenter + record.user.display_name, + record.user ), :diary_entry_title_with_link => link_to( - notification.diary_entry_title, + record.diary_entry.title, diary_entry_path( - notification.diary_author, - notification.diary_entry + record.diary_entry.user, + record.diary_entry ) ) ) %>

- <%= notification.comment_body.to_html %> + <%= record.body.to_html %>
-- 2.47.3