Merge remote-tracking branch 'parent/main' into upstream-20241126
This commit is contained in:
commit
8a075ba4c6
303 changed files with 7495 additions and 4498 deletions
|
@ -5,18 +5,42 @@ class MergeWorker
|
|||
include Redisable
|
||||
include DatabaseHelper
|
||||
|
||||
def perform(from_account_id, into_account_id)
|
||||
def perform(from_account_id, into_id, type = 'home')
|
||||
with_primary do
|
||||
@from_account = Account.find(from_account_id)
|
||||
end
|
||||
|
||||
case type
|
||||
when 'home'
|
||||
merge_into_home!(into_id)
|
||||
when 'list'
|
||||
merge_into_list!(into_id)
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
true
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def merge_into_home!(into_account_id)
|
||||
with_primary do
|
||||
@into_account = Account.find(into_account_id)
|
||||
end
|
||||
|
||||
with_read_replica do
|
||||
FeedManager.instance.merge_into_home(@from_account, @into_account)
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
true
|
||||
ensure
|
||||
redis.del("account:#{into_account_id}:regeneration")
|
||||
end
|
||||
|
||||
def merge_into_list!(into_list_id)
|
||||
with_primary do
|
||||
@into_list = List.find(into_list_id)
|
||||
end
|
||||
|
||||
with_read_replica do
|
||||
FeedManager.instance.merge_into_list(@from_account, @into_list)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,9 +2,18 @@
|
|||
|
||||
class MuteWorker
|
||||
include Sidekiq::Worker
|
||||
include DatabaseHelper
|
||||
|
||||
def perform(account_id, target_account_id)
|
||||
FeedManager.instance.clear_from_home(Account.find(account_id), Account.find(target_account_id))
|
||||
with_primary do
|
||||
@account = Account.find(account_id)
|
||||
@target_account = Account.find(target_account_id)
|
||||
end
|
||||
|
||||
with_read_replica do
|
||||
FeedManager.instance.clear_from_home(@account, @target_account)
|
||||
FeedManager.instance.clear_from_lists(@account, @target_account)
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
true
|
||||
end
|
||||
|
|
|
@ -9,6 +9,8 @@ class PublishScheduledStatusWorker
|
|||
scheduled_status = ScheduledStatus.find(scheduled_status_id)
|
||||
scheduled_status.destroy!
|
||||
|
||||
return true if scheduled_status.account.user.disabled?
|
||||
|
||||
PostStatusService.new.call(
|
||||
scheduled_status.account,
|
||||
options_with_objects(scheduled_status.params.with_indifferent_access)
|
||||
|
|
|
@ -6,16 +6,40 @@ class UnmergeWorker
|
|||
|
||||
sidekiq_options queue: 'pull'
|
||||
|
||||
def perform(from_account_id, into_account_id)
|
||||
def perform(from_account_id, into_id, type = 'home')
|
||||
with_primary do
|
||||
@from_account = Account.find(from_account_id)
|
||||
end
|
||||
|
||||
case type
|
||||
when 'home'
|
||||
unmerge_from_home!(into_id)
|
||||
when 'list'
|
||||
unmerge_from_list!(into_id)
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
true
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def unmerge_from_home!(into_account_id)
|
||||
with_primary do
|
||||
@into_account = Account.find(into_account_id)
|
||||
end
|
||||
|
||||
with_read_replica do
|
||||
FeedManager.instance.unmerge_from_home(@from_account, @into_account)
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
true
|
||||
end
|
||||
|
||||
def unmerge_from_list!(into_list_id)
|
||||
with_primary do
|
||||
@into_list = List.find(into_list_id)
|
||||
end
|
||||
|
||||
with_read_replica do
|
||||
FeedManager.instance.unmerge_from_list(@from_account, @into_list)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue