mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-13 15:58:50 +00:00
Merge commit '877090518682b6c77ba9bdfa0231afd56daec44d' into glitch-soc/merge-upstream
Conflicts: - `app/models/concerns/user/has_settings.rb`: Not a real conflict, upstream added a setting textually close to a glitch-soc one. Added upstream's new setting. - `app/views/settings/preferences/appearance/show.html.haml`: Not a real conflict, upstream added a setting textually close to a glitch-soc one. Added upstream's new setting. - `config/routes.rb`: Upstream moved web app routes to `config/routes/web_app.rb`, while glitch-soc had an extra route. Moved the extra route to `config/routes/web_app.rb`. - `spec/controllers/settings/preferences/appearance_controller_spec.rb`: This spec got converted to a system spec upstream. However, the theme setting works differently in glitch-soc, so the spec had been changed. Changed the corresponding system spec as well.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
dev_null = Logger.new('/dev/null')
|
||||
dev_null = Logger.new(File::NULL)
|
||||
|
||||
Rails.logger = dev_null
|
||||
ActiveRecord::Base.logger = dev_null
|
||||
|
||||
@@ -3,8 +3,10 @@
|
||||
class Mastodon::SidekiqMiddleware
|
||||
BACKTRACE_LIMIT = 3
|
||||
|
||||
def call(*, &block)
|
||||
Chewy.strategy(:mastodon, &block)
|
||||
def call(_worker_class, job, _queue, &block)
|
||||
setup_query_log_tags(job) do
|
||||
Chewy.strategy(:mastodon, &block)
|
||||
end
|
||||
rescue Mastodon::HostValidationError
|
||||
# Do not retry
|
||||
rescue => e
|
||||
@@ -61,4 +63,14 @@ class Mastodon::SidekiqMiddleware
|
||||
Thread.current[:statsd_socket]&.close
|
||||
Thread.current[:statsd_socket] = nil
|
||||
end
|
||||
|
||||
def setup_query_log_tags(job, &block)
|
||||
if Rails.configuration.active_record.query_log_tags_enabled
|
||||
# If `wrapped` is set, this is an `ActiveJob` which is already in the execution context
|
||||
sidekiq_job_class = job['wrapped'].present? ? nil : job['class'].to_s
|
||||
ActiveSupport::ExecutionContext.set(sidekiq_job_class: sidekiq_job_class, &block)
|
||||
else
|
||||
yield
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -126,7 +126,7 @@ class Sanitize
|
||||
|
||||
add_attributes: {
|
||||
'a' => {
|
||||
'rel' => 'nofollow noopener noreferrer',
|
||||
'rel' => 'nofollow noopener',
|
||||
'target' => '_blank',
|
||||
},
|
||||
},
|
||||
@@ -173,7 +173,7 @@ class Sanitize
|
||||
node = env[:node]
|
||||
|
||||
rel = (node['rel'] || '').split & ['tag']
|
||||
rel += %w(nofollow noopener noreferrer) unless TagManager.instance.local_url?(node['href'])
|
||||
rel += %w(nofollow noopener) unless TagManager.instance.local_url?(node['href'])
|
||||
|
||||
if rel.empty?
|
||||
node.remove_attribute('rel')
|
||||
|
||||
@@ -43,8 +43,14 @@ namespace :db do
|
||||
end
|
||||
|
||||
task pre_migration_check: :environment do
|
||||
version = ActiveRecord::Base.connection.database_version
|
||||
abort 'This version of Mastodon requires PostgreSQL 12.0 or newer. Please update PostgreSQL before updating Mastodon.' if version < 120_000
|
||||
pg_version = ActiveRecord::Base.connection.database_version
|
||||
abort 'This version of Mastodon requires PostgreSQL 12.0 or newer. Please update PostgreSQL before updating Mastodon.' if pg_version < 120_000
|
||||
|
||||
schema_version = ActiveRecord::Migrator.current_version
|
||||
abort <<~MESSAGE if ENV['SKIP_POST_DEPLOYMENT_MIGRATIONS'] && schema_version < 2023_09_07_150100
|
||||
Zero-downtime migrations from Mastodon versions earlier than 4.2.0 are not supported.
|
||||
Please update to Mastodon 4.2.x first or upgrade by stopping all services and running migrations without `SKIP_POST_DEPLOYMENT_MIGRATIONS`.
|
||||
MESSAGE
|
||||
end
|
||||
|
||||
Rake::Task['db:migrate'].enhance(['db:pre_migration_check'])
|
||||
|
||||
@@ -592,7 +592,7 @@ namespace :mastodon do
|
||||
end
|
||||
|
||||
def disable_log_stdout!
|
||||
dev_null = Logger.new('/dev/null')
|
||||
dev_null = Logger.new(File::NULL)
|
||||
|
||||
Rails.logger = dev_null
|
||||
ActiveRecord::Base.logger = dev_null
|
||||
|
||||
Reference in New Issue
Block a user