1
0
mirror of https://github.com/mastodon/mastodon synced 2024-11-23 14:46:18 +09:00

Drop support for ruby 3.1 (#32363)

This commit is contained in:
Matt Jankowski 2024-10-31 11:12:08 -04:00 committed by GitHub
parent a20ac20302
commit b231c3c1bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
18 changed files with 38 additions and 43 deletions

View File

@ -124,7 +124,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
ruby-version: ruby-version:
- '3.1'
- '3.2' - '3.2'
- '.ruby-version' - '.ruby-version'
steps: steps:
@ -226,7 +225,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
ruby-version: ruby-version:
- '3.1'
- '3.2' - '3.2'
- '.ruby-version' - '.ruby-version'
steps: steps:
@ -305,7 +303,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
ruby-version: ruby-version:
- '3.1'
- '3.2' - '3.2'
- '.ruby-version' - '.ruby-version'
@ -422,7 +419,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
ruby-version: ruby-version:
- '3.1'
- '3.2' - '3.2'
- '.ruby-version' - '.ruby-version'
search-image: search-image:

View File

@ -8,7 +8,7 @@ AllCops:
- lib/mastodon/migration_helpers.rb - lib/mastodon/migration_helpers.rb
ExtraDetails: true ExtraDetails: true
NewCops: enable NewCops: enable
TargetRubyVersion: 3.1 # Oldest supported ruby version TargetRubyVersion: 3.2 # Oldest supported ruby version
inherit_from: inherit_from:
- .rubocop/layout.yml - .rubocop/layout.yml

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
source 'https://rubygems.org' source 'https://rubygems.org'
ruby '>= 3.1.0' ruby '>= 3.2.0'
gem 'propshaft' gem 'propshaft'
gem 'puma', '~> 6.3' gem 'puma', '~> 6.3'

View File

@ -69,7 +69,7 @@ Mastodon acts as an OAuth2 provider, so 3rd party apps can use the REST and Stre
- **PostgreSQL** 12+ - **PostgreSQL** 12+
- **Redis** 4+ - **Redis** 4+
- **Ruby** 3.1+ - **Ruby** 3.2+
- **Node.js** 18+ - **Node.js** 18+
The repository includes deployment configurations for **Docker and docker-compose** as well as specific platforms like **Heroku**, and **Scalingo**. For Helm charts, reference the [mastodon/chart repository](https://github.com/mastodon/chart). The [**standalone** installation guide](https://docs.joinmastodon.org/admin/install/) is available in the documentation. The repository includes deployment configurations for **Docker and docker-compose** as well as specific platforms like **Heroku**, and **Scalingo**. For Helm charts, reference the [mastodon/chart repository](https://github.com/mastodon/chart). The [**standalone** installation guide](https://docs.joinmastodon.org/admin/install/) is available in the documentation.

View File

@ -41,11 +41,11 @@ class ActivityPub::OutboxesController < ActivityPub::BaseController
end end
end end
def outbox_url(**kwargs) def outbox_url(**)
if params[:account_username].present? if params[:account_username].present?
account_outbox_url(@account, **kwargs) account_outbox_url(@account, **)
else else
instance_actor_outbox_url(**kwargs) instance_actor_outbox_url(**)
end end
end end

View File

@ -106,8 +106,8 @@ class Api::V1::AccountsController < Api::BaseController
render json: { error: I18n.t('accounts.self_follow_error') }, status: 403 if current_user.account.id == @account.id render json: { error: I18n.t('accounts.self_follow_error') }, status: 403 if current_user.account.id == @account.id
end end
def relationships(**options) def relationships(**)
AccountRelationshipsPresenter.new([@account], current_user.account_id, **options) AccountRelationshipsPresenter.new([@account], current_user.account_id, **)
end end
def account_ids def account_ids

View File

@ -28,8 +28,8 @@ class Api::V1::FollowRequestsController < Api::BaseController
@account ||= Account.find(params[:id]) @account ||= Account.find(params[:id])
end end
def relationships(**options) def relationships(**)
AccountRelationshipsPresenter.new([account], current_user.account_id, **options) AccountRelationshipsPresenter.new([account], current_user.account_id, **)
end end
def load_accounts def load_accounts

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
module MediaComponentHelper module MediaComponentHelper
def render_video_component(status, **options) def render_video_component(status, **)
video = status.ordered_media_attachments.first video = status.ordered_media_attachments.first
meta = video.file.meta || {} meta = video.file.meta || {}
@ -18,14 +18,14 @@ module MediaComponentHelper
media: [ media: [
serialize_media_attachment(video), serialize_media_attachment(video),
].as_json, ].as_json,
}.merge(**options) }.merge(**)
react_component :video, component_params do react_component :video, component_params do
render partial: 'statuses/attachment_list', locals: { attachments: status.ordered_media_attachments } render partial: 'statuses/attachment_list', locals: { attachments: status.ordered_media_attachments }
end end
end end
def render_audio_component(status, **options) def render_audio_component(status, **)
audio = status.ordered_media_attachments.first audio = status.ordered_media_attachments.first
meta = audio.file.meta || {} meta = audio.file.meta || {}
@ -38,19 +38,19 @@ module MediaComponentHelper
foregroundColor: meta.dig('colors', 'foreground'), foregroundColor: meta.dig('colors', 'foreground'),
accentColor: meta.dig('colors', 'accent'), accentColor: meta.dig('colors', 'accent'),
duration: meta.dig('original', 'duration'), duration: meta.dig('original', 'duration'),
}.merge(**options) }.merge(**)
react_component :audio, component_params do react_component :audio, component_params do
render partial: 'statuses/attachment_list', locals: { attachments: status.ordered_media_attachments } render partial: 'statuses/attachment_list', locals: { attachments: status.ordered_media_attachments }
end end
end end
def render_media_gallery_component(status, **options) def render_media_gallery_component(status, **)
component_params = { component_params = {
sensitive: sensitive_viewer?(status, current_account), sensitive: sensitive_viewer?(status, current_account),
autoplay: prefers_autoplay?, autoplay: prefers_autoplay?,
media: status.ordered_media_attachments.map { |a| serialize_media_attachment(a).as_json }, media: status.ordered_media_attachments.map { |a| serialize_media_attachment(a).as_json },
}.merge(**options) }.merge(**)
react_component :media_gallery, component_params do react_component :media_gallery, component_params do
render partial: 'statuses/attachment_list', locals: { attachments: status.ordered_media_attachments } render partial: 'statuses/attachment_list', locals: { attachments: status.ordered_media_attachments }

View File

@ -14,8 +14,8 @@ module RoutingHelper
end end
end end
def full_asset_url(source, **options) def full_asset_url(source, **)
source = ActionController::Base.helpers.asset_url(source, **options) unless use_storage? source = ActionController::Base.helpers.asset_url(source, **) unless use_storage?
URI.join(asset_host, source).to_s URI.join(asset_host, source).to_s
end end
@ -24,12 +24,12 @@ module RoutingHelper
Rails.configuration.action_controller.asset_host || root_url Rails.configuration.action_controller.asset_host || root_url
end end
def frontend_asset_path(source, **options) def frontend_asset_path(source, **)
asset_pack_path("media/#{source}", **options) asset_pack_path("media/#{source}", **)
end end
def frontend_asset_url(source, **options) def frontend_asset_url(source, **)
full_asset_url(frontend_asset_path(source, **options)) full_asset_url(frontend_asset_path(source, **))
end end
def use_storage? def use_storage?

View File

@ -20,9 +20,9 @@ class ActivityPub::Activity
end end
class << self class << self
def factory(json, account, **options) def factory(json, account, **)
@json = json @json = json
klass&.new(json, account, **options) klass&.new(json, account, **)
end end
private private

View File

@ -1,8 +1,8 @@
# frozen_string_literal: true # frozen_string_literal: true
class RSS::Element class RSS::Element
def self.with(*args, &block) def self.with(*, &block)
new(*args).tap(&block).to_element new(*).tap(&block).to_element
end end
def create_element(name, content = nil) def create_element(name, content = nil)

View File

@ -42,8 +42,8 @@ class TranslationService::DeepL < TranslationService
subtags.join('-') subtags.join('-')
end end
def request(verb, path, **options) def request(verb, path, **)
req = Request.new(verb, "#{base_url}#{path}", **options) req = Request.new(verb, "#{base_url}#{path}", **)
req.add_headers(Authorization: "DeepL-Auth-Key #{@api_key}") req.add_headers(Authorization: "DeepL-Auth-Key #{@api_key}")
req.perform do |res| req.perform do |res|
case res.code case res.code

View File

@ -27,8 +27,8 @@ class TranslationService::LibreTranslate < TranslationService
private private
def request(verb, path, **options) def request(verb, path, **)
req = Request.new(verb, "#{@base_url}#{path}", allow_local: true, **options) req = Request.new(verb, "#{@base_url}#{path}", allow_local: true, **)
req.add_headers('Content-Type': 'application/json') req.add_headers('Content-Type': 'application/json')
req.perform do |res| req.perform do |res|
case res.code case res.code

View File

@ -29,7 +29,7 @@ module Status::SnapshotConcern
) )
end end
def snapshot!(**options) def snapshot!(**)
build_snapshot(**options).save! build_snapshot(**).save!
end end
end end

View File

@ -35,8 +35,8 @@ class SessionActivation < ApplicationRecord
id && exists?(session_id: id) id && exists?(session_id: id)
end end
def activate(**options) def activate(**)
activation = create!(**options) activation = create!(**)
purge_old purge_old
activation activation
end end

View File

@ -405,8 +405,8 @@ class User < ApplicationRecord
@pending_devise_notifications ||= [] @pending_devise_notifications ||= []
end end
def render_and_send_devise_message(notification, *args, **kwargs) def render_and_send_devise_message(notification, *, **)
devise_mailer.send(notification, self, *args, **kwargs).deliver_later devise_mailer.send(notification, self, *, **).deliver_later
end end
def set_approved def set_approved

View File

@ -1,6 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
require 'set'
require_relative 'base' require_relative 'base'
module Mastodon::CLI module Mastodon::CLI

View File

@ -1,9 +1,9 @@
# frozen_string_literal: true # frozen_string_literal: true
module CommandLineHelpers module CommandLineHelpers
def output_results(*args) def output_results(*)
output( output(
include(*args) include(*)
).to_stdout ).to_stdout
end end
end end