diff --git a/app/assets/javascripts/initializers/initNotifications.js b/app/assets/javascripts/initializers/initNotifications.js index 6f403400f..8a3796366 100644 --- a/app/assets/javascripts/initializers/initNotifications.js +++ b/app/assets/javascripts/initializers/initNotifications.js @@ -23,7 +23,7 @@ function markNotificationsAsRead() { xmlhttp.setRequestHeader('X-CSRF-Token', csrfToken); xmlhttp.send(); } - }, 250); + }, 380); } function fetchNotificationsCount() { diff --git a/app/controllers/notifications_controller.rb b/app/controllers/notifications_controller.rb index 0a48e66c6..a82faf2a3 100644 --- a/app/controllers/notifications_controller.rb +++ b/app/controllers/notifications_controller.rb @@ -8,12 +8,12 @@ class NotificationsController < ApplicationController else current_user end - @notifications = Notification.where(user_id: current_user.id).order("created_at DESC").limit(500).to_a + @notifications = Notification.where(user_id: current_user.id).order("created_at DESC").limit(400).to_a aggregate_notifications("Follow") aggregate_notifications("Reaction") - @notifications = NotificationDecorator.decorate_collection(@notifications)[0..50] - @last_user_reaction = @user.reactions.pluck(:id).last - @last_user_comment = @user.comments.pluck(:id).last + @notifications = NotificationDecorator.decorate_collection(@notifications)[0..40] + @last_user_reaction = @user.reactions.last&.id + @last_user_comment = @user.comments.last&.id end end