0
0
Fork 0

Add support for reversible suspensions through ActivityPub (#14989)

This commit is contained in:
Eugen Rochko 2020-11-08 00:28:39 +01:00 committed by GitHub
parent ee8cf246cf
commit 3134691948
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
47 changed files with 1049 additions and 204 deletions

View file

@ -5,6 +5,10 @@ class UnsuspendAccountService < BaseService
@account = account
unsuspend!
refresh_remote_account!
return if @account.nil?
merge_into_home_timelines!
merge_into_list_timelines!
publish_media_attachments!
@ -16,6 +20,22 @@ class UnsuspendAccountService < BaseService
@account.unsuspend! if @account.suspended?
end
def refresh_remote_account!
return if @account.local?
# While we had the remote account suspended, it could be that
# it got suspended on its origin, too. So, we need to refresh
# it straight away so it gets marked as remotely suspended in
# that case.
@account.update!(last_webfingered_at: nil)
@account = ResolveAccountService.new.call(@account)
# Worth noting that it is possible that the remote has not only
# been suspended, but deleted permanently, in which case
# @account would now be nil.
end
def merge_into_home_timelines!
@account.followers_for_local_distribution.find_each do |follower|
FeedManager.instance.merge_into_home(@account, follower)