chore: Fix RemoveStaleNotificationJob query (#5242)

Rubocop amended the query in #5236, which led to failure as the Message model already has a default scope.
This PR fixes it.
This commit is contained in:
Sojan Jose
2022-08-10 15:08:37 +02:00
committed by GitHub
parent 74fdfffe08
commit 831a3bcd50

View File

@@ -10,7 +10,8 @@ class Migration::RemoveStaleNotificationsJob < ApplicationJob
def remove_invalid_messages
deleted_ids = []
Message.distinct.pluck(:inbox_id).each_slice(1000) do |id_list|
Message.unscoped.distinct.pluck(:inbox_id).each_slice(1000) do |id_list|
deleted_ids << (id_list - Inbox.where(id: id_list).pluck(:id))
end