From ccc83a9916d0fa463938668ca6cc00f6901b6818 Mon Sep 17 00:00:00 2001 From: Jason Zimdars Date: Wed, 21 May 2025 14:07:25 -0500 Subject: [PATCH] Some eventables are comments so we need to get to `card.closed?` via a different method --- app/helpers/notifications_helper.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/helpers/notifications_helper.rb b/app/helpers/notifications_helper.rb index 71dc6260d..592950349 100644 --- a/app/helpers/notifications_helper.rb +++ b/app/helpers/notifications_helper.rb @@ -22,7 +22,7 @@ module NotificationsHelper tag.div id: dom_id(notification), class: "tray__item" do concat( link_to(notification, - class: [ "card card--notification", { "card--closed": notification.notifiable_target.closed? } ], + class: [ "card card--notification", { "card--closed": notification_closed?(notification) } ], data: { action: "click->dialog#close", turbo_frame: "_top" }, &) ) @@ -63,4 +63,9 @@ module NotificationsHelper def card_notification_title(card) card.title.presence || "Card #{card.id}" end + + def notification_closed?(notification) + eventable = notification.source.eventable + eventable.respond_to?(:card) ? eventable.card.closed? : eventable.closed? + end end