Drop support for ruby 3.1 (#32363)
This commit is contained in:
		@@ -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?
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user