inbox_controller: update all inbox entries when requesting turbo stream

since there's no layout rendered which updates all inbox entries the
inbox entries would still be shown as unread

fixes #827
This commit is contained in:
Georg Gadinger 2022-11-24 08:02:42 +01:00 committed by Andreas Nedbal
parent 0529247851
commit a2ae98eee8
2 changed files with 6 additions and 2 deletions

View File

@ -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

View File

@ -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'