From 64e07c8fb405cb6ed9eeb3f1b83b60238c6b799c Mon Sep 17 00:00:00 2001 From: Pablo Brasero Date: Thu, 30 Jul 2026 13:15:44 +0100 Subject: [PATCH] Render note_comment using the record directly --- app/models/user_notifications.rb | 19 -------------- .../notifications/_note_comment.html.erb | 26 +++++++++---------- 2 files changed, 13 insertions(+), 32 deletions(-) diff --git a/app/models/user_notifications.rb b/app/models/user_notifications.rb index 9b6da1fb4..ca09b2faa 100644 --- a/app/models/user_notifications.rb +++ b/app/models/user_notifications.rb @@ -42,25 +42,6 @@ class UserNotifications end class NoteCommentNotification < Notification - delegate :note, :to => :record - delegate :event, :to => :record - delegate :id, :to => :note, :prefix => true - - def comment_body - record.body - end - - def comment_id - record.id - end - - def commenter - record.author - end - - def note_text - note.description - end end LISTABLE_NOTIFICATIONS = %w[ diff --git a/app/views/notifications/_note_comment.html.erb b/app/views/notifications/_note_comment.html.erb index e48a9dd0f..bb09b97bd 100644 --- a/app/views/notifications/_note_comment.html.erb +++ b/app/views/notifications/_note_comment.html.erb @@ -4,39 +4,39 @@

<%= link_to( - t(".headline.#{notification.event}"), + t(".headline.#{record.event}"), note_path( - notification.note, - :anchor => "c#{notification.comment_id}" + record.note, + :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.author, :class => "img-fluid"), + user_url(record.author), :target => "_blank", :rel => "noopener" ) %>

<%= t( - ".description.#{notification.event}_html", + ".description.#{record.event}_html", :commenter_name_with_link => link_to( - notification.commenter.display_name, - notification.commenter + record.author.display_name, + record.author ), - :note_id_with_link => link_to("##{notification.note_id}", notification.note), - :note_text => notification.note_text + :note_id_with_link => link_to("##{record.note_id}", record.note), + :note_text => record.note.description ) %>

- <% if notification.comment_body.present? %> + <% if record.body.present? %>
- <%= notification.comment_body.to_html %> + <%= record.body.to_html %>
<% end %>
-- 2.47.3