From 2744eff9f3d4506128cf9f573b9ea620d6073f06 Mon Sep 17 00:00:00 2001 From: Hampton Lintorn-Catlin Date: Wed, 22 Jul 2026 17:16:27 -0400 Subject: [PATCH] Open unread comments from workspace --- engine/app/controllers/coplan/plans_controller.rb | 7 +++++++ engine/app/views/coplan/plans/index.html.erb | 2 +- spec/requests/plans_spec.rb | 15 ++++++++++++++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/engine/app/controllers/coplan/plans_controller.rb b/engine/app/controllers/coplan/plans_controller.rb index 128f36d..f9dfd6c 100644 --- a/engine/app/controllers/coplan/plans_controller.rb +++ b/engine/app/controllers/coplan/plans_controller.rb @@ -630,6 +630,13 @@ def load_needs_attention @attention_unread_counts = unread_by_plan top_ids = unread_by_plan.sort_by { |_id, count| -count } .first(ATTENTION_LIMIT).map(&:first) + # The plan view hides resolved threads by default. Route each inbox row + # through an unread notification so the destination marks it read and + # deep-links to the exact thread, even when that thread is resolved. + # This is deliberately bounded to ATTENTION_LIMIT indexed lookups. + @attention_notification_ids = top_ids.index_with do |plan_id| + current_user.notifications.unread.where(plan_id: plan_id).newest_first.pick(:id) + end # Even an inbox routes through the discovery predicate — a stale # notification must not resurface an archived plan or another user's # unlisted draft. diff --git a/engine/app/views/coplan/plans/index.html.erb b/engine/app/views/coplan/plans/index.html.erb index 601ebfd..a788d1a 100644 --- a/engine/app/views/coplan/plans/index.html.erb +++ b/engine/app/views/coplan/plans/index.html.erb @@ -112,7 +112,7 @@