mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-18 02:28:08 +00:00
Merge commit '4896d2c4c6d3bd6b878c5a075b6611c65d4203b2' into glitch-soc/merge-upstream
Conflicts: - `app/views/settings/preferences/appearance/show.html.haml`: Upstream changed stuff too close to glitch-soc's theming system changes. Applied upstream's changes. - `streaming/index.js`: Upstream refactored a bunch of stuff where our code was different due to local-only posts. Applied upstream's changes while taking care of local-only posts.
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']
|
||||
@@ -147,6 +164,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