Merge remote-tracking branch 'parent/main' into upstream-20241101
This commit is contained in:
commit
1c1f76697b
200 changed files with 1931 additions and 741 deletions
|
@ -31,11 +31,14 @@ module FormattingHelper
|
|||
end
|
||||
|
||||
def status_content_format(status)
|
||||
html_aware_format(status.text, status.local?, markdown: status.markdown, preloaded_accounts: [status.account] + (status.respond_to?(:active_mentions) ? status.active_mentions.map(&:account) : []))
|
||||
end
|
||||
MastodonOTELTracer.in_span('HtmlAwareFormatter rendering') do |span|
|
||||
span.add_attributes(
|
||||
'app.formatter.content.type' => 'status',
|
||||
'app.formatter.content.origin' => status.local? ? 'local' : 'remote'
|
||||
)
|
||||
|
||||
def emoji_name_format(emoji_reaction, status)
|
||||
html_aware_format(emoji_reaction['url'].present? ? ":#{emoji_reaction['name']}:" : emoji_reaction['name'], status.local?, markdown: status.markdown)
|
||||
html_aware_format(status.text, status.local?, markdown: status.markdown, preloaded_accounts: [status.account] + (status.respond_to?(:active_mentions) ? status.active_mentions.map(&:account) : []))
|
||||
end
|
||||
end
|
||||
|
||||
def rss_status_content_format(status)
|
||||
|
@ -47,7 +50,14 @@ module FormattingHelper
|
|||
end
|
||||
|
||||
def account_bio_format(account)
|
||||
html_aware_format(account.note, account.local?, markdown: account.user&.setting_bio_markdown)
|
||||
MastodonOTELTracer.in_span('HtmlAwareFormatter rendering') do |span|
|
||||
span.add_attributes(
|
||||
'app.formatter.content.type' => 'account_bio',
|
||||
'app.formatter.content.origin' => account.local? ? 'local' : 'remote'
|
||||
)
|
||||
|
||||
html_aware_format(account.note, account.local?, markdown: account.user&.setting_bio_markdown)
|
||||
end
|
||||
end
|
||||
|
||||
def account_field_value_format(field, with_rel_me: true)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module MediaComponentHelper
|
||||
def render_video_component(status, **options)
|
||||
def render_video_component(status, **)
|
||||
video = status.ordered_media_attachments.first
|
||||
|
||||
meta = video.file.meta || {}
|
||||
|
@ -18,14 +18,14 @@ module MediaComponentHelper
|
|||
media: [
|
||||
serialize_media_attachment(video),
|
||||
].as_json,
|
||||
}.merge(**options)
|
||||
}.merge(**)
|
||||
|
||||
react_component :video, component_params do
|
||||
render partial: 'statuses/attachment_list', locals: { attachments: status.ordered_media_attachments }
|
||||
end
|
||||
end
|
||||
|
||||
def render_audio_component(status, **options)
|
||||
def render_audio_component(status, **)
|
||||
audio = status.ordered_media_attachments.first
|
||||
|
||||
meta = audio.file.meta || {}
|
||||
|
@ -38,19 +38,19 @@ module MediaComponentHelper
|
|||
foregroundColor: meta.dig('colors', 'foreground'),
|
||||
accentColor: meta.dig('colors', 'accent'),
|
||||
duration: meta.dig('original', 'duration'),
|
||||
}.merge(**options)
|
||||
}.merge(**)
|
||||
|
||||
react_component :audio, component_params do
|
||||
render partial: 'statuses/attachment_list', locals: { attachments: status.ordered_media_attachments }
|
||||
end
|
||||
end
|
||||
|
||||
def render_media_gallery_component(status, **options)
|
||||
def render_media_gallery_component(status, **)
|
||||
component_params = {
|
||||
sensitive: sensitive_viewer?(status, current_account),
|
||||
autoplay: prefers_autoplay?,
|
||||
media: status.ordered_media_attachments.map { |a| serialize_media_attachment(a).as_json },
|
||||
}.merge(**options)
|
||||
}.merge(**)
|
||||
|
||||
react_component :media_gallery, component_params do
|
||||
render partial: 'statuses/attachment_list', locals: { attachments: status.ordered_media_attachments }
|
||||
|
|
|
@ -14,8 +14,8 @@ module RoutingHelper
|
|||
end
|
||||
end
|
||||
|
||||
def full_asset_url(source, **options)
|
||||
source = ActionController::Base.helpers.asset_url(source, **options) unless use_storage?
|
||||
def full_asset_url(source, **)
|
||||
source = ActionController::Base.helpers.asset_url(source, **) unless use_storage?
|
||||
|
||||
URI.join(asset_host, source).to_s
|
||||
end
|
||||
|
@ -24,12 +24,12 @@ module RoutingHelper
|
|||
Rails.configuration.action_controller.asset_host || root_url
|
||||
end
|
||||
|
||||
def frontend_asset_path(source, **options)
|
||||
asset_pack_path("media/#{source}", **options)
|
||||
def frontend_asset_path(source, **)
|
||||
asset_pack_path("media/#{source}", **)
|
||||
end
|
||||
|
||||
def frontend_asset_url(source, **options)
|
||||
full_asset_url(frontend_asset_path(source, **options))
|
||||
def frontend_asset_url(source, **)
|
||||
full_asset_url(frontend_asset_path(source, **))
|
||||
end
|
||||
|
||||
def use_storage?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue