mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-21 20:15:10 +01:00
Fix processing of incoming authorizations/rejections
This commit is contained in:
parent
514fdfa268
commit
e610555e10
@ -33,6 +33,8 @@ class ProcessInteractionService < BaseService
|
|||||||
follow_request!(account, target_account) unless !target_account.locked? || target_account.blocking?(account)
|
follow_request!(account, target_account) unless !target_account.locked? || target_account.blocking?(account)
|
||||||
when :authorize
|
when :authorize
|
||||||
authorize_follow_request!(account, target_account)
|
authorize_follow_request!(account, target_account)
|
||||||
|
when :reject
|
||||||
|
reject_follow_request!(account, target_account)
|
||||||
when :unfollow
|
when :unfollow
|
||||||
unfollow!(account, target_account)
|
unfollow!(account, target_account)
|
||||||
when :favorite
|
when :favorite
|
||||||
@ -76,14 +78,20 @@ class ProcessInteractionService < BaseService
|
|||||||
NotifyService.new.call(target_account, follow)
|
NotifyService.new.call(target_account, follow)
|
||||||
end
|
end
|
||||||
|
|
||||||
def follow_request(account, target_account)
|
def follow_request!(account, target_account)
|
||||||
follow_request = FollowRequest.create!(account: account, target_account: target_account)
|
follow_request = FollowRequest.create!(account: account, target_account: target_account)
|
||||||
NotifyService.new.call(target_account, follow_request)
|
NotifyService.new.call(target_account, follow_request)
|
||||||
end
|
end
|
||||||
|
|
||||||
def authorize_target_account!(account, target_account)
|
def authorize_follow_request!(account, target_account)
|
||||||
follow_request = FollowRequest.find_by(account: target_account, target_account: account)
|
follow_request = FollowRequest.find_by(account: target_account, target_account: account)
|
||||||
follow_request&.authorize!
|
follow_request&.authorize!
|
||||||
|
SubscribeService.new.call(account) unless account.subscribed?
|
||||||
|
end
|
||||||
|
|
||||||
|
def reject_follow_request!(account, target_account)
|
||||||
|
follow_request = FollowRequest.find_by(account: target_account, target_account: account)
|
||||||
|
follow_request&.reject!
|
||||||
end
|
end
|
||||||
|
|
||||||
def unfollow!(account, target_account)
|
def unfollow!(account, target_account)
|
||||||
|
Loading…
Reference in New Issue
Block a user