Mark notification as read when visiting service settings
This commit is contained in:
parent
baffd05d6f
commit
d320a74045
|
@ -2,6 +2,7 @@
|
|||
|
||||
class ServicesController < ApplicationController
|
||||
before_action :authenticate_user!
|
||||
before_action :mark_notifications_as_read, only: %i[index]
|
||||
|
||||
def index
|
||||
@services = current_user.services
|
||||
|
@ -59,4 +60,10 @@ class ServicesController < ApplicationController
|
|||
def omniauth_hash
|
||||
request.env["omniauth.auth"]
|
||||
end
|
||||
|
||||
def mark_notifications_as_read
|
||||
Notification::ServiceTokenExpired
|
||||
.where(recipient: current_user, new: true)
|
||||
.update_all(new: false) # rubocop:disable Rails/SkipsModelValidations
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue