0
0
Fork 0

Add support for private pinned posts (#16954)

* Add support for private pinned toots

* Allow local user to pin private toots

* Change wording to avoid "direct message"
This commit is contained in:
Claire 2022-01-17 00:49:55 +01:00 committed by GitHub
parent 081e4426f8
commit d5c9feb7b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 164 additions and 28 deletions

View file

@ -3,7 +3,7 @@
class ActivityPub::Activity::Accept < ActivityPub::Activity
def perform
return accept_follow_for_relay if relay_follow?
return follow_request_from_object.authorize! unless follow_request_from_object.nil?
return accept_follow!(follow_request_from_object) unless follow_request_from_object.nil?
case @object['type']
when 'Follow'
@ -19,7 +19,16 @@ class ActivityPub::Activity::Accept < ActivityPub::Activity
return if target_account.nil? || !target_account.local?
follow_request = FollowRequest.find_by(account: target_account, target_account: @account)
follow_request&.authorize!
accept_follow!(follow_request)
end
def accept_follow!(request)
return if request.nil?
is_first_follow = !request.target_account.followers.local.exists?
request.authorize!
RemoteAccountRefreshWorker.perform_async(request.target_account_id) if is_first_follow
end
def accept_follow_for_relay

View file

@ -4,8 +4,7 @@ class ActivityPub::Activity::Add < ActivityPub::Activity
def perform
return unless @json['target'].present? && value_or_id(@json['target']) == @account.featured_collection_url
status = status_from_uri(object_uri)
status ||= fetch_remote_original_status
status = status_from_object
return unless !status.nil? && status.account_id == @account.id && !@account.pinned?(status)