mirror of
https://github.com/mastodon/mastodon.git
synced 2025-05-07 12:16:14 +00:00

Some checks failed
Check i18n / check-i18n (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
CodeQL / Analyze (ruby) (push) Has been cancelled
Check formatting / lint (push) Has been cancelled
Ruby Linting / lint (push) Has been cancelled
Historical data migration test / test (14-alpine) (push) Has been cancelled
Historical data migration test / test (15-alpine) (push) Has been cancelled
Historical data migration test / test (16-alpine) (push) Has been cancelled
Historical data migration test / test (17-alpine) (push) Has been cancelled
Ruby Testing / build (production) (push) Has been cancelled
Ruby Testing / build (test) (push) Has been cancelled
Ruby Testing / test (.ruby-version) (push) Has been cancelled
Ruby Testing / test (3.2) (push) Has been cancelled
Ruby Testing / test (3.3) (push) Has been cancelled
Ruby Testing / Libvips tests (.ruby-version) (push) Has been cancelled
Ruby Testing / Libvips tests (3.2) (push) Has been cancelled
Ruby Testing / Libvips tests (3.3) (push) Has been cancelled
Ruby Testing / End to End testing (.ruby-version) (push) Has been cancelled
Ruby Testing / End to End testing (3.2) (push) Has been cancelled
Ruby Testing / End to End testing (3.3) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:8.10.2) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (.ruby-version, opensearchproject/opensearch:2) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (3.2, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (3.3, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Has been cancelled
Bundler Audit / security (push) Has been cancelled
31 lines
1009 B
Ruby
31 lines
1009 B
Ruby
# frozen_string_literal: true
|
|
|
|
class ActivityPub::Activity::QuoteRequest < ActivityPub::Activity
|
|
include Payloadable
|
|
|
|
def perform
|
|
return unless Mastodon::Feature.inbound_quotes_enabled?
|
|
return if non_matching_uri_hosts?(@account.uri, @json['id'])
|
|
|
|
quoted_status = status_from_uri(object_uri)
|
|
return if quoted_status.nil? || !quoted_status.account.local? || !quoted_status.distributable?
|
|
|
|
# For now, we don't support being quoted by external servers
|
|
reject_quote_request!(quoted_status)
|
|
end
|
|
|
|
private
|
|
|
|
def reject_quote_request!(quoted_status)
|
|
quote = Quote.new(
|
|
quoted_status: quoted_status,
|
|
quoted_account: quoted_status.account,
|
|
status: Status.new(account: @account, uri: @json['instrument']),
|
|
account: @account,
|
|
activity_uri: @json['id']
|
|
)
|
|
json = Oj.dump(serialize_payload(quote, ActivityPub::RejectQuoteRequestSerializer))
|
|
ActivityPub::DeliveryWorker.perform_async(json, quoted_status.account_id, @account.inbox_url)
|
|
end
|
|
end
|