Merge branch 'main' into glitch-soc/merge-upstream
Conflicts: - `.prettierignore`: Upstream added a line at the end of the file, while glitch-soc had its own extra lines. Took upstream's change. - `CONTRIBUTING.md`: We have our custom CONTRIBUTING.md quoting upstream. Upstream made changes. Ported upstream changes. - `app/controllers/application_controller.rb`: Upstream made code style changes in a method that is entirely replaced in glitch-soc. Ignored the change. - `app/models/account.rb`: Code style changes textually close to glitch-soc-specific changes. Ported upstream changes. - `lib/sanitize_ext/sanitize_config.rb`: Upstream code style changes. Ignored them.
This commit is contained in:
@@ -148,6 +148,7 @@ module Mastodon
|
||||
begin
|
||||
Request.new(:get, "https://#{domain}/api/v1/instance").perform do |res|
|
||||
next unless res.code == 200
|
||||
|
||||
stats[domain] = Oj.load(res.to_s)
|
||||
end
|
||||
|
||||
@@ -161,9 +162,10 @@ module Mastodon
|
||||
|
||||
Request.new(:get, "https://#{domain}/api/v1/instance/activity").perform do |res|
|
||||
next unless res.code == 200
|
||||
|
||||
stats[domain]['activity'] = Oj.load(res.to_s)
|
||||
end
|
||||
rescue StandardError
|
||||
rescue
|
||||
failed.increment
|
||||
ensure
|
||||
processed.increment
|
||||
|
@@ -68,7 +68,7 @@ module Mastodon
|
||||
failed += 1
|
||||
say('Failure/Error: ', :red)
|
||||
say(entry.full_name)
|
||||
say(' ' + custom_emoji.errors[:image].join(', '), :red)
|
||||
say(" #{custom_emoji.errors[:image].join(', ')}", :red)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@@ -289,7 +289,7 @@ module Mastodon
|
||||
end
|
||||
|
||||
@prompt.say 'Restoring account domain blocks indexes…'
|
||||
ActiveRecord::Base.connection.add_index :account_domain_blocks, ['account_id', 'domain'], name: 'index_account_domain_blocks_on_account_id_and_domain', unique: true
|
||||
ActiveRecord::Base.connection.add_index :account_domain_blocks, %w(account_id domain), name: 'index_account_domain_blocks_on_account_id_and_domain', unique: true
|
||||
end
|
||||
|
||||
def deduplicate_account_identity_proofs!
|
||||
@@ -303,7 +303,7 @@ module Mastodon
|
||||
end
|
||||
|
||||
@prompt.say 'Restoring account identity proofs indexes…'
|
||||
ActiveRecord::Base.connection.add_index :account_identity_proofs, ['account_id', 'provider', 'provider_username'], name: 'index_account_proofs_on_account_and_provider_and_username', unique: true
|
||||
ActiveRecord::Base.connection.add_index :account_identity_proofs, %w(account_id provider provider_username), name: 'index_account_proofs_on_account_and_provider_and_username', unique: true
|
||||
end
|
||||
|
||||
def deduplicate_announcement_reactions!
|
||||
@@ -317,7 +317,7 @@ module Mastodon
|
||||
end
|
||||
|
||||
@prompt.say 'Restoring announcement_reactions indexes…'
|
||||
ActiveRecord::Base.connection.add_index :announcement_reactions, ['account_id', 'announcement_id', 'name'], name: 'index_announcement_reactions_on_account_id_and_announcement_id', unique: true
|
||||
ActiveRecord::Base.connection.add_index :announcement_reactions, %w(account_id announcement_id name), name: 'index_announcement_reactions_on_account_id_and_announcement_id', unique: true
|
||||
end
|
||||
|
||||
def deduplicate_conversations!
|
||||
@@ -359,7 +359,7 @@ module Mastodon
|
||||
end
|
||||
|
||||
@prompt.say 'Restoring custom_emojis indexes…'
|
||||
ActiveRecord::Base.connection.add_index :custom_emojis, ['shortcode', 'domain'], name: 'index_custom_emojis_on_shortcode_and_domain', unique: true
|
||||
ActiveRecord::Base.connection.add_index :custom_emojis, %w(shortcode domain), name: 'index_custom_emojis_on_shortcode_and_domain', unique: true
|
||||
end
|
||||
|
||||
def deduplicate_custom_emoji_categories!
|
||||
@@ -550,7 +550,7 @@ module Mastodon
|
||||
@prompt.warn 'All those accounts are distinct accounts but only the most recently-created one is fully-functional.'
|
||||
|
||||
accounts.each_with_index do |account, idx|
|
||||
@prompt.say '%2d. %s: created at: %s; updated at: %s; last logged in at: %s; statuses: %5d; last status at: %s' % [idx, account.username, account.created_at, account.updated_at, account.user&.last_sign_in_at&.to_s || 'N/A', account.account_stat&.statuses_count || 0, account.account_stat&.last_status_at || 'N/A']
|
||||
@prompt.say format('%2d. %s: created at: %s; updated at: %s; last logged in at: %s; statuses: %5d; last status at: %s', idx, account.username, account.created_at, account.updated_at, account.user&.last_sign_in_at&.to_s || 'N/A', account.account_stat&.statuses_count || 0, account.account_stat&.last_status_at || 'N/A')
|
||||
end
|
||||
|
||||
@prompt.say 'Please chose the one to keep unchanged, other ones will be automatically renamed.'
|
||||
|
@@ -13,7 +13,7 @@ module PremailerWebpackStrategy
|
||||
HTTP.get(url).to_s
|
||||
else
|
||||
url = url[1..-1] if url.start_with?('/')
|
||||
File.read(Rails.public_path.join(url))
|
||||
Rails.public_path.join(url).read
|
||||
end
|
||||
|
||||
css.gsub(/url\(\//, "url(#{asset_host}/")
|
||||
|
@@ -1,17 +1,17 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
def setup_redis_env_url(prefix = nil, defaults = true)
|
||||
prefix = prefix.to_s.upcase + '_' unless prefix.nil?
|
||||
prefix = "#{prefix.to_s.upcase}_" unless prefix.nil?
|
||||
prefix = '' if prefix.nil?
|
||||
|
||||
return if ENV[prefix + 'REDIS_URL'].present?
|
||||
return if ENV["#{prefix}REDIS_URL"].present?
|
||||
|
||||
password = ENV.fetch(prefix + 'REDIS_PASSWORD') { '' if defaults }
|
||||
host = ENV.fetch(prefix + 'REDIS_HOST') { 'localhost' if defaults }
|
||||
port = ENV.fetch(prefix + 'REDIS_PORT') { 6379 if defaults }
|
||||
db = ENV.fetch(prefix + 'REDIS_DB') { 0 if defaults }
|
||||
password = ENV.fetch("#{prefix}REDIS_PASSWORD") { '' if defaults }
|
||||
host = ENV.fetch("#{prefix}REDIS_HOST") { 'localhost' if defaults }
|
||||
port = ENV.fetch("#{prefix}REDIS_PORT") { 6379 if defaults }
|
||||
db = ENV.fetch("#{prefix}REDIS_DB") { 0 if defaults }
|
||||
|
||||
ENV[prefix + 'REDIS_URL'] = begin
|
||||
ENV["#{prefix}REDIS_URL"] = begin
|
||||
if [password, host, port, db].all?(&:nil?)
|
||||
ENV['REDIS_URL']
|
||||
else
|
||||
@@ -27,7 +27,7 @@ setup_redis_env_url(:cache, false)
|
||||
setup_redis_env_url(:sidekiq, false)
|
||||
|
||||
namespace = ENV.fetch('REDIS_NAMESPACE', nil)
|
||||
cache_namespace = namespace ? namespace + '_cache' : 'cache'
|
||||
cache_namespace = namespace ? "#{namespace}_cache" : 'cache'
|
||||
sidekiq_namespace = namespace
|
||||
|
||||
REDIS_CACHE_PARAMS = {
|
||||
|
@@ -115,7 +115,7 @@ module Mastodon::Snowflake
|
||||
# And only those that are using timestamp_id.
|
||||
next unless (data = DEFAULT_REGEX.match(id_col.default_function))
|
||||
|
||||
seq_name = data[:seq_prefix] + '_id_seq'
|
||||
seq_name = "#{data[:seq_prefix]}_id_seq"
|
||||
|
||||
# If we were on Postgres 9.5+, we could do CREATE SEQUENCE IF
|
||||
# NOT EXISTS, but we can't depend on that. Instead, catch the
|
||||
|
Reference in New Issue
Block a user