Skip to content

Commit

Permalink
Drop EOL Ruby 2.7 (mastodon#24237)
Browse files Browse the repository at this point in the history
  • Loading branch information
nschonni authored and Michael Mitchell committed May 3, 2023
1 parent 5ddd6ae commit 101758a
Show file tree
Hide file tree
Showing 12 changed files with 12 additions and 27 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/test-ruby.yml
Expand Up @@ -104,7 +104,6 @@ jobs:
fail-fast: false
matrix:
ruby-version:
- '2.7'
- '3.0'
- '3.1'
- '.ruby-version'
Expand Down Expand Up @@ -136,10 +135,6 @@ jobs:
ruby-version: ${{ matrix.ruby-version}}
bundler-cache: true

- name: Update system gems
if: matrix.ruby-version == '2.7'
run: gem update --system

- name: Load database schema
run: './bin/rails db:create db:schema:load db:seed'

Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Expand Up @@ -13,7 +13,7 @@ require:
- rubocop-capybara

AllCops:
TargetRubyVersion: 2.7 # Set to minimum supported version of CI
TargetRubyVersion: 3.0 # Set to minimum supported version of CI
DisplayCopNames: true
DisplayStyleGuide: true
ExtraDetails: true
Expand Down
12 changes: 1 addition & 11 deletions .rubocop_todo.yml
Expand Up @@ -173,11 +173,6 @@ Lint/EmptyClass:
Exclude:
- 'spec/controllers/api/base_controller_spec.rb'

# This cop supports unsafe autocorrection (--autocorrect-all).
Lint/NonDeterministicRequireOrder:
Exclude:
- 'spec/rails_helper.rb'

Lint/NonLocalExitFromIterator:
Exclude:
- 'app/helpers/jsonld_helper.rb'
Expand Down Expand Up @@ -2207,16 +2202,11 @@ Style/MapToHash:
# SupportedStyles: literals, strict
Style/MutableConstant:
Exclude:
- 'app/lib/link_details_extractor.rb'
- 'app/models/account.rb'
- 'app/models/custom_emoji.rb'
- 'app/models/tag.rb'
- 'app/services/account_search_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'
- 'lib/mastodon/snowflake.rb'
- 'lib/mastodon/migration_warning.rb'
- 'spec/controllers/api/base_controller_spec.rb'

# This cop supports safe autocorrection (--autocorrect).
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
@@ -1,7 +1,7 @@
# frozen_string_literal: true

source 'https://rubygems.org'
ruby '>= 2.7.0', '< 3.3.0'
ruby '>= 3.0.0'

gem 'pkg-config', '~> 1.5'

Expand Down
2 changes: 1 addition & 1 deletion app/lib/emoji_formatter.rb
Expand Up @@ -3,7 +3,7 @@
class EmojiFormatter
include RoutingHelper

DISALLOWED_BOUNDING_REGEX = /[[:alnum:]:]/.freeze
DISALLOWED_BOUNDING_REGEX = /[[:alnum:]:]/

attr_reader :html, :custom_emojis, :options

Expand Down
2 changes: 1 addition & 1 deletion app/lib/plain_text_formatter.rb
Expand Up @@ -3,7 +3,7 @@
class PlainTextFormatter
include ActionView::Helpers::TextHelper

NEWLINE_TAGS_RE = /(<br \/>|<br>|<\/p>)+/.freeze
NEWLINE_TAGS_RE = /(<br \/>|<br>|<\/p>)+/

attr_reader :text, :local

Expand Down
2 changes: 1 addition & 1 deletion app/lib/text_formatter.rb
Expand Up @@ -5,7 +5,7 @@ class TextFormatter
include ERB::Util
include RoutingHelper

URL_PREFIX_REGEX = /\A(https?:\/\/(www\.)?|xmpp:)/.freeze
URL_PREFIX_REGEX = /\A(https?:\/\/(www\.)?|xmpp:)/

DEFAULT_REL = %w(nofollow noopener noreferrer).freeze

Expand Down
2 changes: 1 addition & 1 deletion app/models/account.rb
Expand Up @@ -410,7 +410,7 @@ def requires_review_notification?
end

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'))"

REPUTATION_SCORE_FUNCTION = '(greatest(0, coalesce(s.followers_count, 0)) / (greatest(0, coalesce(s.following_count, 0)) + 1.0))'
Expand Down
2 changes: 1 addition & 1 deletion app/models/concerns/omniauthable.rb
Expand Up @@ -4,7 +4,7 @@ module Omniauthable
extend ActiveSupport::Concern

TEMP_EMAIL_PREFIX = 'change@me'
TEMP_EMAIL_REGEX = /\A#{TEMP_EMAIL_PREFIX}/.freeze
TEMP_EMAIL_REGEX = /\A#{TEMP_EMAIL_PREFIX}/

included do
devise :omniauthable
Expand Down
2 changes: 1 addition & 1 deletion app/services/fetch_oembed_service.rb
Expand Up @@ -2,7 +2,7 @@

class FetchOEmbedService
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

Expand Down
4 changes: 2 additions & 2 deletions config/initializers/rack_attack.rb
Expand Up @@ -98,8 +98,8 @@ def paging_request?
req.throttleable_remote_ip if req.paging_request? && req.unauthenticated?
end

API_DELETE_REBLOG_REGEX = /\A\/api\/v1\/statuses\/[\d]+\/unreblog\z/.freeze
API_DELETE_STATUS_REGEX = /\A\/api\/v1\/statuses\/[\d]+\z/.freeze
API_DELETE_REBLOG_REGEX = /\A\/api\/v1\/statuses\/[\d]+\/unreblog\z/
API_DELETE_STATUS_REGEX = /\A\/api\/v1\/statuses\/[\d]+\z/

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))
Expand Down
2 changes: 1 addition & 1 deletion db/seeds.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true

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
end
end

0 comments on commit 101758a

Please sign in to comment.