Merge commit '425d77f8124a50fc033e8fb3bdf7b89a6a25f4fa' into glitch-soc/merge-upstream

Conflicts:
- `.rubocop_todo.yml`:
  Upstream regenerated this file, glitch-soc had a specific ignore.
- `README.md`:
  Upstream updated its README, but glitch-soc has a completely different one.
  Kept glitch-soc's README
This commit is contained in:
Claire
2023-08-11 22:15:41 +02:00
130 changed files with 1818 additions and 1188 deletions

View File

@@ -1,15 +0,0 @@
# frozen_string_literal: true
module ActionController
module ConditionalGetExtensions
def expires_in(*)
# This backports a fix from Rails 7 so that a more private Cache-Control
# can be overriden by calling expires_in on a specific controller action
response.cache_control.delete(:no_store)
super
end
end
end
ActionController::ConditionalGet.prepend(ActionController::ConditionalGetExtensions)

View File

@@ -61,7 +61,7 @@ module Mastodon::CLI
# Skip accounts followed by local accounts
clean_followed_sql = 'AND NOT EXISTS (SELECT 1 FROM follows WHERE statuses.account_id = follows.target_account_id)' unless options[:clean_followed]
ActiveRecord::Base.connection.exec_insert(<<-SQL.squish, 'SQL', [[nil, max_id]])
ActiveRecord::Base.connection.exec_insert(<<-SQL.squish, 'SQL', [max_id])
INSERT INTO statuses_to_be_deleted (id)
SELECT statuses.id FROM statuses WHERE deleted_at IS NULL AND NOT local AND uri IS NOT NULL AND (id < $1)
AND NOT EXISTS (SELECT 1 FROM statuses AS statuses1 WHERE statuses.id = statuses1.in_reply_to_id)

View File

@@ -13,7 +13,7 @@ module Mastodon
end
def patch
5
6
end
def flags

View File

@@ -2,13 +2,15 @@
module Paperclip
module MediaTypeSpoofDetectorExtensions
MARCEL_MIME_TYPES = %w(audio/mpeg image/avif).freeze
def calculated_content_type
return @calculated_content_type if defined?(@calculated_content_type)
@calculated_content_type = type_from_file_command.chomp
# The `file` command fails to recognize some MP3 files as such
@calculated_content_type = type_from_marcel if @calculated_content_type == 'application/octet-stream' && type_from_marcel == 'audio/mpeg'
@calculated_content_type = type_from_marcel if @calculated_content_type == 'application/octet-stream' && type_from_marcel.in?(MARCEL_MIME_TYPES)
@calculated_content_type
end

View File

@@ -438,12 +438,7 @@ namespace :mastodon do
"#{key}=#{escaped}"
end.join("\n")
generated_header = "# Generated with mastodon:setup on #{Time.now.utc}\n\n".dup
if incompatible_syntax
generated_header << "# Some variables in this file will be interpreted differently whether you are\n"
generated_header << "# using docker-compose or not.\n\n"
end
generated_header = generate_header(incompatible_syntax)
Rails.root.join('.env.production').write("#{generated_header}#{env_contents}\n")
@@ -538,6 +533,19 @@ namespace :mastodon do
puts "VAPID_PUBLIC_KEY=#{vapid_key.public_key}"
end
end
private
def generate_header(include_warning)
default_message = "# Generated with mastodon:setup on #{Time.now.utc}\n\n"
default_message.tap do |string|
if include_warning
string << "# Some variables in this file will be interpreted differently whether you are\n"
string << "# using docker-compose or not.\n\n"
end
end
end
end
def disable_log_stdout!

11
lib/tasks/spec.rake Normal file
View File

@@ -0,0 +1,11 @@
# frozen_string_literal: true
if Rake::Task.task_defined?('spec:system')
namespace :spec do
task :enable_system_specs do # rubocop:disable Rails/RakeEnvironment
ENV['RUN_SYSTEM_SPECS'] = 'true'
end
end
Rake::Task['spec:system'].enhance ['spec:enable_system_specs']
end