mirror of
https://github.com/mastodon/mastodon.git
synced 2024-08-20 21:08:15 -07:00
Convert object attributes if possible, regardless of type
Try to use the object title and summary (spoiler_text) as spoiler_text, and the content as text if available. For unsupported types, the object URL is still used as fallback, to leverage the card visualization (OpenGraph or oEmbed) if offered by the remote server.
This commit is contained in:
parent
c39a8e1061
commit
3fa44600eb
1 changed files with 2 additions and 2 deletions
|
@ -118,7 +118,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
|||
account: @account,
|
||||
text: converted_object_type? ? converted_text : (@status_parser.text || ''),
|
||||
language: @status_parser.language,
|
||||
spoiler_text: converted_object_type? ? '' : (@status_parser.spoiler_text || ''),
|
||||
spoiler_text: [@status_parser.title.presence, @status_parser.spoiler_text.presence].compact.join(' · '),
|
||||
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],
|
||||
|
@ -375,7 +375,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
|||
end
|
||||
|
||||
def converted_text
|
||||
linkify([@status_parser.title.presence, @status_parser.spoiler_text.presence, @status_parser.url || @status_parser.uri].compact.join("\n\n"))
|
||||
@status_parser.text || linkify(@status_parser.url || @status_parser.uri)
|
||||
end
|
||||
|
||||
def unsupported_media_type?(mime_type)
|
||||
|
|
Loading…
Reference in a new issue