parent
44b3484cb2
commit
ca8337b937
|
@ -342,6 +342,7 @@ module GabSocial
|
||||||
say("OK, followed target from #{processed} accounts, skipped #{failed}", :green)
|
say("OK, followed target from #{processed} accounts, skipped #{failed}", :green)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
option :number, type: :numeric, aliases: [:n]
|
||||||
desc 'unfollow ACCT', 'Make all local accounts unfollow account specified by ACCT'
|
desc 'unfollow ACCT', 'Make all local accounts unfollow account specified by ACCT'
|
||||||
long_desc <<-LONG_DESC
|
long_desc <<-LONG_DESC
|
||||||
Make all local accounts unfollow an account specified by ACCT. ACCT can be
|
Make all local accounts unfollow an account specified by ACCT. ACCT can be
|
||||||
|
@ -349,16 +350,26 @@ module GabSocial
|
||||||
username@domain, in case of a remote user.
|
username@domain, in case of a remote user.
|
||||||
LONG_DESC
|
LONG_DESC
|
||||||
def unfollow(acct)
|
def unfollow(acct)
|
||||||
target_account = Account.find_remote(*acct.split('@'))
|
target_account = nil
|
||||||
processed = 0
|
followers = nil
|
||||||
failed = 0
|
|
||||||
|
if options[:number]
|
||||||
|
target_account = Account.find(acct)
|
||||||
|
followers = target_account.followers.local.limit(options[:number]).reorder(created_at: :asc)
|
||||||
|
else
|
||||||
|
say('Error. Specify a limit', :red)
|
||||||
|
exit(1)
|
||||||
|
end
|
||||||
|
|
||||||
|
processed = 0
|
||||||
|
failed = 0
|
||||||
|
|
||||||
if target_account.nil?
|
if target_account.nil?
|
||||||
say("Target account (#{acct}) was not found", :red)
|
say("Target account (#{acct}) was not found", :red)
|
||||||
exit(1)
|
exit(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
target_account.followers.local.find_each do |account|
|
followers.find_each do |account|
|
||||||
begin
|
begin
|
||||||
UnfollowService.new.call(account, target_account)
|
UnfollowService.new.call(account, target_account)
|
||||||
processed += 1
|
processed += 1
|
||||||
|
|
Loading…
Reference in New Issue