Merge commit 'f877aa9d70d0d600961989b8e97c0e0ce3ac1db6' into glitch-soc/merge-upstream

Conflicts:
- `.github/dependabot.yml`:
  Upstream made changes, but we had removed it.
  Discarded upstream changes.
- `.rubocop_todo.yml`:
  Upstream regenerated the file, we had some glitch-soc-specific ignores.
- `app/models/account_statuses_filter.rb`:
  Minor upstream code style change where glitch-soc had slightly different code
  due to handling of local-only posts.
  Updated to match upstream's code style.
- `app/models/status.rb`:
  Upstream moved ActiveRecord callback definitions, glitch-soc had an extra one.
  Moved the definitions as upstream did.
- `app/services/backup_service.rb`:
  Upstream rewrote a lot of the backup service, glitch-soc had changes because
  of exporting local-only posts.
  Took upstream changes and added back code to deal with local-only posts.
- `config/routes.rb`:
  Upstream split the file into different files, while glitch-soc had a few
  extra routes.
  Extra routes added to `config/routes/settings.rb`, `config/routes/api.rb`
  and `config/routes/admin.rb`
- `db/schema.rb`:
  Upstream has new migrations, while glitch-soc had an extra migration.
  Updated the expected serial number to match upstream's.
- `lib/mastodon/version.rb`:
  Upstream added support to set version tags from environment variables, while
  glitch-soc has an extra `+glitch` tag.
  Changed the code to support upstream's feature but prepending a `+glitch`.
- `spec/lib/activitypub/activity/create_spec.rb`:
  Minor code style change upstream, while glitch-soc has extra tests due to
  `directMessage` handling.
  Applied upstream's changes while keeping glitch-soc's extra tests.
- `spec/models/concerns/account_interactions_spec.rb`:
  Minor code style change upstream, while glitch-soc has extra tests.
  Applied upstream's changes while keeping glitch-soc's extra tests.
This commit is contained in:
Claire
2023-05-08 19:05:55 +02:00
429 changed files with 6138 additions and 3323 deletions

View File

@ -121,10 +121,10 @@ module Mastodon
say('OK', :green)
say("New password: #{password}")
else
user.errors.to_h.each do |key, error|
user.errors.each do |error|
say('Failure/Error: ', :red)
say(key)
say(" #{error}", :red)
say(error.attribute)
say(" #{error.type}", :red)
end
exit(1)
@ -197,10 +197,10 @@ module Mastodon
say('OK', :green)
say("New password: #{password}") if options[:reset_password]
else
user.errors.to_h.each do |key, error|
user.errors.each do |error|
say('Failure/Error: ', :red)
say(key)
say(" #{error}", :red)
say(error.attribute)
say(" #{error.type}", :red)
end
exit(1)
@ -353,7 +353,7 @@ module Mastodon
begin
code = Request.new(:head, account.uri).perform(&:code)
rescue HTTP::TimeoutError, HTTP::ConnectionError, OpenSSL::SSL::SSLError
rescue HTTP::TimeoutError, HTTP::ConnectionError, OpenSSL::SSL::SSLError, Mastodon::PrivateNetworkAddressError
skip_domains << account.domain
end

View File

@ -73,7 +73,6 @@ module Mastodon
end
end
puts
say("Imported #{imported}, skipped #{skipped}, failed to import #{failed}", color(imported, skipped, failed))
end

View File

@ -664,9 +664,7 @@ module Mastodon
def remove_index_if_exists!(table, name)
ActiveRecord::Base.connection.remove_index(table, name: name)
rescue ArgumentError
nil
rescue ActiveRecord::StatementInvalid
rescue ArgumentError, ActiveRecord::StatementInvalid
nil
end
end

View File

@ -9,6 +9,8 @@ module Mastodon
include ActionView::Helpers::NumberHelper
include CLIHelper
VALID_PATH_SEGMENTS_SIZE = [7, 10].freeze
def self.exit_on_failure?
true
end
@ -133,7 +135,7 @@ module Mastodon
path_segments = object.key.split('/')
path_segments.delete('cache')
unless [7, 10].include?(path_segments.size)
unless VALID_PATH_SEGMENTS_SIZE.include?(path_segments.size)
progress.log(pastel.yellow("Unrecognized file found: #{object.key}"))
next
end
@ -177,7 +179,7 @@ module Mastodon
path_segments = key.split(File::SEPARATOR)
path_segments.delete('cache')
unless [7, 10].include?(path_segments.size)
unless VALID_PATH_SEGMENTS_SIZE.include?(path_segments.size)
progress.log(pastel.yellow("Unrecognized file found: #{key}"))
next
end
@ -310,7 +312,7 @@ module Mastodon
path_segments = path.split('/')[2..]
path_segments.delete('cache')
unless [7, 10].include?(path_segments.size)
unless VALID_PATH_SEGMENTS_SIZE.include?(path_segments.size)
say('Not a media URL', :red)
exit(1)
end
@ -363,7 +365,7 @@ module Mastodon
segments = object.key.split('/')
segments.delete('cache')
next unless [7, 10].include?(segments.size)
next unless VALID_PATH_SEGMENTS_SIZE.include?(segments.size)
model_name = segments.first.classify
record_id = segments[2..-2].join.to_i

View File

@ -17,11 +17,11 @@ module Mastodon
end
def flags
''
ENV.fetch('MASTODON_VERSION_FLAGS', '')
end
def suffix
'+glitch'
"+glitch#{ENV.fetch('MASTODON_VERSION_SUFFIX', '')}"
end
def to_a