537afa00f3
Conflicts: - `app/lib/feed_manager.rb`: Not a real conflict, glitch-soc-only DM-related method too close to changed upstream stuff. Ported upstream changes. - `app/services/batched_remove_status_service.rb`: Additional logic in glitch-soc to clear DMs from timelines. Ported upstream changes and fixed the DM TL clearing logic. - `app/workers/scheduler/feed_cleanup_scheduler.rb`: Additional code in glitch-soc to clear DM timelines. Ported upstream changes.
40 lines
790 B
Ruby
40 lines
790 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Scheduler::FeedCleanupScheduler
|
|
include Sidekiq::Worker
|
|
include Redisable
|
|
|
|
sidekiq_options lock: :until_executed, retry: 0
|
|
|
|
def perform
|
|
clean_home_feeds!
|
|
clean_list_feeds!
|
|
clean_direct_feeds!
|
|
end
|
|
|
|
private
|
|
|
|
def clean_home_feeds!
|
|
feed_manager.clean_feeds!(:home, inactive_account_ids)
|
|
end
|
|
|
|
def clean_list_feeds!
|
|
feed_manager.clean_feeds!(:list, inactive_list_ids)
|
|
end
|
|
|
|
def clean_direct_feeds!
|
|
feed_manager.clean_feeds!(:direct, inactive_account_ids)
|
|
end
|
|
|
|
def inactive_account_ids
|
|
@inactive_account_ids ||= User.confirmed.inactive.pluck(:account_id)
|
|
end
|
|
|
|
def inactive_list_ids
|
|
List.where(account_id: inactive_account_ids).pluck(:id)
|
|
end
|
|
|
|
def feed_manager
|
|
FeedManager.instance
|
|
end
|
|
end
|