mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-26 15:32:37 +00:00
Skip ActivityPub Announces of non-public objects (#6230)
* Skip ActivityPub Announces of non-public objects * Skip OStatus reblogs of non-public statuses
This commit is contained in:
parent
d41f0b66cc
commit
35b84985a8
|
@ -5,7 +5,7 @@ class ActivityPub::Activity::Announce < ActivityPub::Activity
|
||||||
original_status = status_from_uri(object_uri)
|
original_status = status_from_uri(object_uri)
|
||||||
original_status ||= fetch_remote_original_status
|
original_status ||= fetch_remote_original_status
|
||||||
|
|
||||||
return if original_status.nil? || delete_arrived_first?(@json['id'])
|
return if original_status.nil? || delete_arrived_first?(@json['id']) || !announceable?(original_status)
|
||||||
|
|
||||||
status = Status.find_by(account: @account, reblog: original_status)
|
status = Status.find_by(account: @account, reblog: original_status)
|
||||||
|
|
||||||
|
@ -33,4 +33,8 @@ class ActivityPub::Activity::Announce < ActivityPub::Activity
|
||||||
::FetchRemoteStatusService.new.call(@object['url'])
|
::FetchRemoteStatusService.new.call(@object['url'])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def announceable?(status)
|
||||||
|
status.public_visibility? || status.unlisted_visibility?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -26,6 +26,9 @@ class OStatus::Activity::Creation < OStatus::Activity::Base
|
||||||
cached_reblog = reblog
|
cached_reblog = reblog
|
||||||
status = nil
|
status = nil
|
||||||
|
|
||||||
|
# Skip if the reblogged status is not public
|
||||||
|
return if cached_reblog && !(cached_reblog.public_visibility? || cached_reblog.unlisted_visibility?)
|
||||||
|
|
||||||
media_attachments = save_media
|
media_attachments = save_media
|
||||||
|
|
||||||
ApplicationRecord.transaction do
|
ApplicationRecord.transaction do
|
||||||
|
|
Loading…
Reference in a new issue