diff --git a/app/controllers/inbox_controller.rb b/app/controllers/inbox_controller.rb index c5af4593..6954b5a1 100644 --- a/app/controllers/inbox_controller.rb +++ b/app/controllers/inbox_controller.rb @@ -49,7 +49,11 @@ class InboxController < ApplicationController @disabled = true if @inbox.empty? respond_to do |format| format.html - format.turbo_stream { render "show", layout: false, status: :see_other } + format.turbo_stream do + render "show", layout: false, status: :see_other + + @inbox.update_all(new: false) + end end end diff --git a/app/views/layouts/inbox.html.haml b/app/views/layouts/inbox.html.haml index 0aff256e..e87d6cbb 100644 --- a/app/views/layouts/inbox.html.haml +++ b/app/views/layouts/inbox.html.haml @@ -8,6 +8,6 @@ = render 'shared/links' :ruby - Inbox.where(id: @inbox.ids).update_all(new: false) + @inbox.update_all(new: false) provide(:title, generate_title('Inbox')) parent_layout 'base'