mirror of
https://github.com/funamitech/mastodon
synced 2024-12-15 07:09:03 +09:00
3e63fcd4f0
Conflicts: - `app/models/status.rb`: Minor upstream refactor moved hook definitions around, and glitch-soc has an extra `before_create`. Moved the `before_create` accordingly. - `app/services/batched_remove_status_service.rb`: Minor upstream refactor changed a block in which glitch-soc had one extra call to handle direct timelines. Adapted changes to keep glitch-soc's extra call.
42 lines
905 B
Ruby
42 lines
905 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Vacuum::FeedsVacuum
|
|
def perform
|
|
vacuum_inactive_home_feeds!
|
|
vacuum_inactive_list_feeds!
|
|
vacuum_inactive_direct_feeds!
|
|
end
|
|
|
|
private
|
|
|
|
def vacuum_inactive_home_feeds!
|
|
inactive_users.select(:id, :account_id).in_batches do |users|
|
|
feed_manager.clean_feeds!(:home, users.pluck(:account_id))
|
|
end
|
|
end
|
|
|
|
def vacuum_inactive_list_feeds!
|
|
inactive_users_lists.select(:id).in_batches do |lists|
|
|
feed_manager.clean_feeds!(:list, lists.ids)
|
|
end
|
|
end
|
|
|
|
def vacuum_inactive_direct_feeds!
|
|
inactive_users_lists.select(:id).find_in_batches do |lists|
|
|
feed_manager.clean_feeds!(:direct, lists.map(&:id))
|
|
end
|
|
end
|
|
|
|
def inactive_users
|
|
User.confirmed.inactive
|
|
end
|
|
|
|
def inactive_users_lists
|
|
List.where(account_id: inactive_users.select(:account_id))
|
|
end
|
|
|
|
def feed_manager
|
|
FeedManager.instance
|
|
end
|
|
end
|