Merge commit 'b6fd14f0e2842eca269ef8962e3c5bd560a76357' into glitch-soc/merge-upstream

Conflicts:
- `app/lib/activitypub/parser/status_parser.rb`:
  Glitch-soc had changes to adjacent lines.
  Ported upstream's changes.
This commit is contained in:
Claire
2024-05-23 20:30:23 +02:00
16 changed files with 346 additions and 127 deletions

View File

@@ -3,6 +3,8 @@
class ActivityPub::Parser::StatusParser
include JsonLdHelper
NORMALIZED_LOCALE_NAMES = LanguagesHelper::SUPPORTED_LOCALES.keys.index_by(&:downcase).freeze
# @param [Hash] json
# @param [Hash] options
# @option options [String] :followers_collection
@@ -89,6 +91,13 @@ class ActivityPub::Parser::StatusParser
end
def language
lang = raw_language_code
lang.presence && NORMALIZED_LOCALE_NAMES.fetch(lang.downcase.to_sym, lang)
end
private
def raw_language_code
if content_language_map?
@object['contentMap'].keys.first
elsif name_language_map?
@@ -102,8 +111,6 @@ class ActivityPub::Parser::StatusParser
@object['directMessage']
end
private
def audience_to
as_array(@object['to'] || @json['to']).map { |x| value_or_id(x) }
end