Explicitly record Tombstone quotes as deleted

This adds a `deleted` state to the internal representation, but this does
not change the API, which already included such a state.
This commit is contained in:
Claire 2025-10-09 15:55:49 +02:00
commit d7d6407d41
6 changed files with 12 additions and 6 deletions

View file

@ -220,8 +220,8 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
return unless @status_parser.quote?
approval_uri = @status_parser.quote_approval_uri
approval_uri = nil if unsupported_uri_scheme?(approval_uri)
@quote = Quote.new(account: @account, approval_uri: approval_uri, legacy: @status_parser.legacy_quote?)
approval_uri = nil if unsupported_uri_scheme?(approval_uri) || TagManager.instance.local_url?(approval_uri)
@quote = Quote.new(account: @account, approval_uri: approval_uri, legacy: @status_parser.legacy_quote?, state: @status_parser.deleted_quote? ? :deleted : :pending)
end
def process_hashtag(tag)

View file

@ -121,6 +121,10 @@ class ActivityPub::Parser::StatusParser
%w(quote _misskey_quote quoteUrl quoteUri).any? { |key| @object[key].present? }
end
def deleted_quote?
@object['quote'].is_a?(Hash) && @object['quote']['type'] == 'Tombstone'
end
def quote_uri
%w(quote _misskey_quote quoteUrl quoteUri).filter_map do |key|
value_or_id(as_array(@object[key]).first)