diff --git a/app/jobs/migration/remove_stale_notifications_job.rb b/app/jobs/migration/remove_stale_notifications_job.rb index 27a055d0d..0727e6843 100644 --- a/app/jobs/migration/remove_stale_notifications_job.rb +++ b/app/jobs/migration/remove_stale_notifications_job.rb @@ -12,7 +12,7 @@ class Migration::RemoveStaleNotificationsJob < ApplicationJob def remove_conversation_notifications deleted_ids = [] Notification.where(primary_actor_type: 'Conversation').pluck(:primary_actor_id).uniq.each_slice(1000) do |id_list| - deleted_ids << id_list - Conversation.where(id: id_list).pluck(:id) + deleted_ids << (id_list - Conversation.where(id: id_list).pluck(:id)) end Notification.where(primary_actor_type: 'Conversation', primary_actor_id: deleted_ids).destroy_all end @@ -20,7 +20,7 @@ class Migration::RemoveStaleNotificationsJob < ApplicationJob def remove_message_notifications deleted_ids = [] Notification.where(primary_actor_type: 'Message').pluck(:primary_actor_id).uniq.each_slice(1000) do |id_list| - deleted_ids << id_list - Message.where(id: id_list).pluck(:id) + deleted_ids << (id_list - Message.where(id: id_list).pluck(:id)) end Notification.where(primary_actor_type: 'Message', primary_actor_id: deleted_ids).destroy_all end