diff --git a/engine/app/controllers/coplan/notifications_controller.rb b/engine/app/controllers/coplan/notifications_controller.rb index 2c6886e..8efbcbe 100644 --- a/engine/app/controllers/coplan/notifications_controller.rb +++ b/engine/app/controllers/coplan/notifications_controller.rb @@ -45,7 +45,20 @@ def mark_all_read broadcast_badge_update - redirect_to notifications_path, notice: "All notifications marked as read." + respond_to do |format| + format.turbo_stream { + @notifications = current_user.notifications + .includes(:plan, :comment, comment_thread: [:created_by_user]) + .newest_first + .unread + @unread_count = 0 + render turbo_stream: [ + turbo_stream.update("inbox-badge", "0"), + turbo_stream.replace("inbox-panel", partial: "coplan/notifications/panel") + ] + } + format.html { redirect_to notifications_path, notice: "All notifications marked as read." } + end end private diff --git a/engine/app/views/coplan/notifications/_panel.html.erb b/engine/app/views/coplan/notifications/_panel.html.erb index 6690614..aa97038 100644 --- a/engine/app/views/coplan/notifications/_panel.html.erb +++ b/engine/app/views/coplan/notifications/_panel.html.erb @@ -2,7 +2,7 @@