From 8a20f061c2d679043db7b6b6e404c516d0f1296d Mon Sep 17 00:00:00 2001 From: Pablo Brasero Date: Thu, 30 Jul 2026 12:47:08 +0100 Subject: [PATCH] Render changeset_comment using the record directly --- app/models/user_notifications.rb | 18 ------------ .../notifications/_changeset_comment.html.erb | 28 +++++++++---------- 2 files changed, 14 insertions(+), 32 deletions(-) diff --git a/app/models/user_notifications.rb b/app/models/user_notifications.rb index 6977f348d..2d6fee0b3 100644 --- a/app/models/user_notifications.rb +++ b/app/models/user_notifications.rb @@ -25,24 +25,6 @@ class UserNotifications end class ChangesetCommentNotification < Notification - delegate :changeset, :to => :record - delegate :id, :to => :changeset, :prefix => true - - def changeset_summary - changeset.comment - end - - def commenter - record.author - end - - def comment_id - record.id - end - - def comment_body - record.body - end end class DiaryCommentNotification < Notification diff --git a/app/views/notifications/_changeset_comment.html.erb b/app/views/notifications/_changeset_comment.html.erb index d81ba0d7f..5e16e05b1 100644 --- a/app/views/notifications/_changeset_comment.html.erb +++ b/app/views/notifications/_changeset_comment.html.erb @@ -6,47 +6,47 @@ <%= link_to( t(".headline"), changeset_path( - notification.changeset, - :anchor => "c#{notification.comment_id}" + record.changeset, + :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" ) %>

- <% if notification.changeset_summary %> + <% if record.changeset.comment %> <%= t( ".description_with_summary_html", :commenter_name_with_link => link_to( - notification.commenter.display_name, - notification.commenter + record.author.display_name, + record.author ), - :changeset_id_with_link => link_to("##{notification.changeset_id}", notification.changeset), - :changeset_summary => notification.changeset_summary + :changeset_id_with_link => link_to("##{record.changeset_id}", record.changeset), + :changeset_summary => record.changeset.comment ) %> <% else %> <%= t( ".description_without_summary_html", :commenter_name_with_link => link_to( - notification.commenter.display_name, - notification.commenter + record.author.display_name, + record.author ), - :changeset_id_with_link => link_to("##{notification.changeset_id}", notification.changeset) + :changeset_id_with_link => link_to("##{record.changeset_id}", record.changeset) ) %> <% end %>

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