Add support for Update of converted object types (#36322)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ActivityPub::Parser::StatusParser
|
||||
include FormattingHelper
|
||||
include JsonLdHelper
|
||||
|
||||
NORMALIZED_LOCALE_NAMES = LanguagesHelper::SUPPORTED_LOCALES.keys.index_by(&:downcase).freeze
|
||||
@@ -44,6 +45,16 @@ class ActivityPub::Parser::StatusParser
|
||||
end
|
||||
end
|
||||
|
||||
def processed_text
|
||||
return text || '' unless converted_object_type?
|
||||
|
||||
[
|
||||
title.presence && "<h2>#{title}</h2>",
|
||||
spoiler_text.presence,
|
||||
linkify(url || uri),
|
||||
].compact.join("\n\n")
|
||||
end
|
||||
|
||||
def spoiler_text
|
||||
if @object['summary'].present?
|
||||
@object['summary']
|
||||
@@ -52,6 +63,12 @@ class ActivityPub::Parser::StatusParser
|
||||
end
|
||||
end
|
||||
|
||||
def processed_spoiler_text
|
||||
return '' if converted_object_type?
|
||||
|
||||
spoiler_text || ''
|
||||
end
|
||||
|
||||
def title
|
||||
if @object['name'].present?
|
||||
@object['name']
|
||||
@@ -145,6 +162,10 @@ class ActivityPub::Parser::StatusParser
|
||||
as_array(@object['quoteAuthorization']).first
|
||||
end
|
||||
|
||||
def converted_object_type?
|
||||
equals_or_includes_any?(@object['type'], ActivityPub::Activity::CONVERTED_TYPES)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def quote_subpolicy(subpolicy)
|
||||
|
||||
Reference in New Issue
Block a user