Drop EOL Ruby 2.7 (#24237)

This commit is contained in:
Nick Schonning 2023-04-26 19:46:18 -04:00 committed by GitHub
parent d8a06c1375
commit 49fad26eca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 12 additions and 27 deletions

View File

@ -104,7 +104,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
ruby-version: ruby-version:
- '2.7'
- '3.0' - '3.0'
- '3.1' - '3.1'
- '.ruby-version' - '.ruby-version'
@ -136,10 +135,6 @@ jobs:
ruby-version: ${{ matrix.ruby-version}} ruby-version: ${{ matrix.ruby-version}}
bundler-cache: true bundler-cache: true
- name: Update system gems
if: matrix.ruby-version == '2.7'
run: gem update --system
- name: Load database schema - name: Load database schema
run: './bin/rails db:create db:schema:load db:seed' run: './bin/rails db:create db:schema:load db:seed'

View File

@ -13,7 +13,7 @@ require:
- rubocop-capybara - rubocop-capybara
AllCops: AllCops:
TargetRubyVersion: 2.7 # Set to minimum supported version of CI TargetRubyVersion: 3.0 # Set to minimum supported version of CI
DisplayCopNames: true DisplayCopNames: true
DisplayStyleGuide: true DisplayStyleGuide: true
ExtraDetails: true ExtraDetails: true

View File

@ -173,11 +173,6 @@ Lint/EmptyClass:
Exclude: Exclude:
- 'spec/controllers/api/base_controller_spec.rb' - 'spec/controllers/api/base_controller_spec.rb'
# This cop supports unsafe autocorrection (--autocorrect-all).
Lint/NonDeterministicRequireOrder:
Exclude:
- 'spec/rails_helper.rb'
Lint/NonLocalExitFromIterator: Lint/NonLocalExitFromIterator:
Exclude: Exclude:
- 'app/helpers/jsonld_helper.rb' - 'app/helpers/jsonld_helper.rb'
@ -2207,16 +2202,11 @@ Style/MapToHash:
# SupportedStyles: literals, strict # SupportedStyles: literals, strict
Style/MutableConstant: Style/MutableConstant:
Exclude: Exclude:
- 'app/lib/link_details_extractor.rb'
- 'app/models/account.rb' - 'app/models/account.rb'
- 'app/models/custom_emoji.rb'
- 'app/models/tag.rb' - 'app/models/tag.rb'
- 'app/services/account_search_service.rb'
- 'app/services/delete_account_service.rb' - 'app/services/delete_account_service.rb'
- 'app/services/fetch_link_card_service.rb'
- 'app/services/resolve_url_service.rb'
- 'config/initializers/twitter_regex.rb' - 'config/initializers/twitter_regex.rb'
- 'lib/mastodon/snowflake.rb' - 'lib/mastodon/migration_warning.rb'
- 'spec/controllers/api/base_controller_spec.rb' - 'spec/controllers/api/base_controller_spec.rb'
# This cop supports safe autocorrection (--autocorrect). # This cop supports safe autocorrection (--autocorrect).

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
source 'https://rubygems.org' source 'https://rubygems.org'
ruby '>= 2.7.0', '< 3.3.0' ruby '>= 3.0.0'
gem 'pkg-config', '~> 1.5' gem 'pkg-config', '~> 1.5'

View File

@ -3,7 +3,7 @@
class EmojiFormatter class EmojiFormatter
include RoutingHelper include RoutingHelper
DISALLOWED_BOUNDING_REGEX = /[[:alnum:]:]/.freeze DISALLOWED_BOUNDING_REGEX = /[[:alnum:]:]/
attr_reader :html, :custom_emojis, :options attr_reader :html, :custom_emojis, :options

View File

@ -3,7 +3,7 @@
class PlainTextFormatter class PlainTextFormatter
include ActionView::Helpers::TextHelper include ActionView::Helpers::TextHelper
NEWLINE_TAGS_RE = /(<br \/>|<br>|<\/p>)+/.freeze NEWLINE_TAGS_RE = /(<br \/>|<br>|<\/p>)+/
attr_reader :text, :local attr_reader :text, :local

View File

@ -5,7 +5,7 @@ class TextFormatter
include ERB::Util include ERB::Util
include RoutingHelper include RoutingHelper
URL_PREFIX_REGEX = /\A(https?:\/\/(www\.)?|xmpp:)/.freeze URL_PREFIX_REGEX = /\A(https?:\/\/(www\.)?|xmpp:)/
DEFAULT_REL = %w(nofollow noopener noreferrer).freeze DEFAULT_REL = %w(nofollow noopener noreferrer).freeze

View File

@ -410,7 +410,7 @@ class Account < ApplicationRecord
end end
class << self class << self
DISALLOWED_TSQUERY_CHARACTERS = /['?\\:]/.freeze DISALLOWED_TSQUERY_CHARACTERS = /['?\\:]/
TEXTSEARCH = "(setweight(to_tsvector('simple', accounts.display_name), 'A') || setweight(to_tsvector('simple', accounts.username), 'B') || setweight(to_tsvector('simple', coalesce(accounts.domain, '')), 'C'))" TEXTSEARCH = "(setweight(to_tsvector('simple', accounts.display_name), 'A') || setweight(to_tsvector('simple', accounts.username), 'B') || setweight(to_tsvector('simple', coalesce(accounts.domain, '')), 'C'))"
REPUTATION_SCORE_FUNCTION = '(greatest(0, coalesce(s.followers_count, 0)) / (greatest(0, coalesce(s.following_count, 0)) + 1.0))' REPUTATION_SCORE_FUNCTION = '(greatest(0, coalesce(s.followers_count, 0)) / (greatest(0, coalesce(s.following_count, 0)) + 1.0))'

View File

@ -4,7 +4,7 @@ module Omniauthable
extend ActiveSupport::Concern extend ActiveSupport::Concern
TEMP_EMAIL_PREFIX = 'change@me' TEMP_EMAIL_PREFIX = 'change@me'
TEMP_EMAIL_REGEX = /\A#{TEMP_EMAIL_PREFIX}/.freeze TEMP_EMAIL_REGEX = /\A#{TEMP_EMAIL_PREFIX}/
included do included do
devise :omniauthable devise :omniauthable

View File

@ -2,7 +2,7 @@
class FetchOEmbedService class FetchOEmbedService
ENDPOINT_CACHE_EXPIRES_IN = 24.hours.freeze ENDPOINT_CACHE_EXPIRES_IN = 24.hours.freeze
URL_REGEX = /(=(http[s]?(%3A|:)(\/\/|%2F%2F)))([^&]*)/i.freeze URL_REGEX = /(=(http[s]?(%3A|:)(\/\/|%2F%2F)))([^&]*)/i
attr_reader :url, :options, :format, :endpoint_url attr_reader :url, :options, :format, :endpoint_url

View File

@ -98,8 +98,8 @@ class Rack::Attack
req.throttleable_remote_ip if req.paging_request? && req.unauthenticated? req.throttleable_remote_ip if req.paging_request? && req.unauthenticated?
end end
API_DELETE_REBLOG_REGEX = /\A\/api\/v1\/statuses\/[\d]+\/unreblog\z/.freeze API_DELETE_REBLOG_REGEX = /\A\/api\/v1\/statuses\/[\d]+\/unreblog\z/
API_DELETE_STATUS_REGEX = /\A\/api\/v1\/statuses\/[\d]+\z/.freeze API_DELETE_STATUS_REGEX = /\A\/api\/v1\/statuses\/[\d]+\z/
throttle('throttle_api_delete', limit: 30, period: 30.minutes) do |req| throttle('throttle_api_delete', limit: 30, period: 30.minutes) do |req|
req.authenticated_user_id if (req.post? && req.path.match?(API_DELETE_REBLOG_REGEX)) || (req.delete? && req.path.match?(API_DELETE_STATUS_REGEX)) req.authenticated_user_id if (req.post? && req.path.match?(API_DELETE_REBLOG_REGEX)) || (req.delete? && req.path.match?(API_DELETE_STATUS_REGEX))

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
Chewy.strategy(:mastodon) do Chewy.strategy(:mastodon) do
Dir[Rails.root.join('db', 'seeds', '*.rb')].sort.each do |seed| Dir[Rails.root.join('db', 'seeds', '*.rb')].each do |seed|
load seed load seed
end end
end end