From 4cab189750391b97b13b8efa32e49e4b230e0b44 Mon Sep 17 00:00:00 2001 From: Karina Kwiatek Date: Mon, 8 May 2023 18:55:25 +0200 Subject: [PATCH 1/2] Fix notification cache timestamp not being touched after marking all as read --- app/controllers/notifications_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/notifications_controller.rb b/app/controllers/notifications_controller.rb index defe6410..b0088074 100644 --- a/app/controllers/notifications_controller.rb +++ b/app/controllers/notifications_controller.rb @@ -27,6 +27,7 @@ class NotificationsController < ApplicationController def read current_user.notifications.where(new: true).update_all(new: false) # rubocop:disable Rails/SkipsModelValidations + current_user.touch(:notifications_updated_at) respond_to do |format| format.turbo_stream do From 2db4ce38c9c02e20f92a50a0ec5fb44b30d77f6a Mon Sep 17 00:00:00 2001 From: Karina Kwiatek Date: Mon, 8 May 2023 19:00:41 +0200 Subject: [PATCH 2/2] Add stub notification partial for content pending deletion --- app/views/notifications/type/_nilclass.html.haml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 app/views/notifications/type/_nilclass.html.haml diff --git a/app/views/notifications/type/_nilclass.html.haml b/app/views/notifications/type/_nilclass.html.haml new file mode 100644 index 00000000..a6932516 --- /dev/null +++ b/app/views/notifications/type/_nilclass.html.haml @@ -0,0 +1,2 @@ +-# This is a stub to prevent errors on broken notifications on content being asynchronously destroyed. +- logger.error "Notification ##{notification.id} has a target which doesn't exist. (Target: #{notification.target_type}##{notification.target_id})"