Make follow requests federate
This commit is contained in:
parent
d551e43a9b
commit
149887a0ff
25 changed files with 148 additions and 61 deletions
|
@ -29,6 +29,10 @@ class ProcessInteractionService < BaseService
|
|||
case verb(xml)
|
||||
when :follow
|
||||
follow!(account, target_account) unless target_account.locked? || target_account.blocking?(account)
|
||||
when :request_friend
|
||||
follow_request!(account, target_account) unless !target_account.locked? || target_account.blocking?(account)
|
||||
when :authorize
|
||||
authorize_follow_request!(account, target_account)
|
||||
when :unfollow
|
||||
unfollow!(account, target_account)
|
||||
when :favorite
|
||||
|
@ -72,6 +76,16 @@ class ProcessInteractionService < BaseService
|
|||
NotifyService.new.call(target_account, follow)
|
||||
end
|
||||
|
||||
def follow_request(account, target_account)
|
||||
follow_request = FollowRequest.create!(account: account, target_account: target_account)
|
||||
NotifyService.new.call(target_account, follow_request)
|
||||
end
|
||||
|
||||
def authorize_target_account!(account, target_account)
|
||||
follow_request = FollowRequest.find_by(account: target_account, target_account: account)
|
||||
follow_request&.authorize!
|
||||
end
|
||||
|
||||
def unfollow!(account, target_account)
|
||||
account.unfollow!(target_account)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue