2
0

Add support for Update of converted object types (#36322)

This commit is contained in:
Claire
2025-10-28 15:05:14 +01:00
committed by GitHub
parent 9c7d09993d
commit 8fb524e07f
5 changed files with 108 additions and 27 deletions

View File

@@ -1,8 +1,6 @@
# frozen_string_literal: true
class ActivityPub::Activity::Create < ActivityPub::Activity
include FormattingHelper
def perform
@account.schedule_refresh_if_stale!
@@ -99,9 +97,9 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
uri: @status_parser.uri,
url: @status_parser.url || @status_parser.uri,
account: @account,
text: converted_object_type? ? converted_text : (@status_parser.text || ''),
text: @status_parser.processed_text,
language: @status_parser.language,
spoiler_text: converted_object_type? ? '' : (@status_parser.spoiler_text || ''),
spoiler_text: @status_parser.processed_spoiler_text,
created_at: @status_parser.created_at,
edited_at: @status_parser.edited_at && @status_parser.edited_at != @status_parser.created_at ? @status_parser.edited_at : nil,
override_timestamps: @options[:override_timestamps],
@@ -405,18 +403,6 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
value_or_id(@object['inReplyTo'])
end
def converted_text
[formatted_title, @status_parser.spoiler_text.presence, formatted_url].compact.join("\n\n")
end
def formatted_title
"<h2>#{@status_parser.title}</h2>" if @status_parser.title.present?
end
def formatted_url
linkify(@status_parser.url || @status_parser.uri)
end
def unsupported_media_type?(mime_type)
mime_type.present? && !MediaAttachment.supported_mime_types.include?(mime_type)
end