Merge branch 'master' into glitch-soc/merge-upstream
Conflicts: - app/models/media_attachment.rb Upstream raised max image size from 8MB to 10MB while our limit is configurable. Raised the default to 10MB.
This commit is contained in:
		@@ -17,7 +17,7 @@ module Mastodon
 | 
			
		||||
    option :verbose, type: :boolean, aliases: [:v]
 | 
			
		||||
    option :dry_run, type: :boolean
 | 
			
		||||
    option :whitelist_mode, type: :boolean
 | 
			
		||||
    desc 'purge [DOMAIN]', 'Remove accounts from a DOMAIN without a trace'
 | 
			
		||||
    desc 'purge [DOMAIN...]', 'Remove accounts from a DOMAIN without a trace'
 | 
			
		||||
    long_desc <<-LONG_DESC
 | 
			
		||||
      Remove all accounts from a given DOMAIN without leaving behind any
 | 
			
		||||
      records. Unlike a suspension, if the DOMAIN still exists in the wild,
 | 
			
		||||
@@ -27,16 +27,16 @@ module Mastodon
 | 
			
		||||
      from a single domain, all accounts from domains that are not whitelisted
 | 
			
		||||
      are removed from the database.
 | 
			
		||||
    LONG_DESC
 | 
			
		||||
    def purge(domain = nil)
 | 
			
		||||
    def purge(*domains)
 | 
			
		||||
      dry_run = options[:dry_run] ? ' (DRY RUN)' : ''
 | 
			
		||||
 | 
			
		||||
      scope = begin
 | 
			
		||||
        if options[:whitelist_mode]
 | 
			
		||||
          Account.remote.where.not(domain: DomainAllow.pluck(:domain))
 | 
			
		||||
        elsif domain.present?
 | 
			
		||||
          Account.remote.where(domain: domain)
 | 
			
		||||
        elsif !domains.empty?
 | 
			
		||||
          Account.remote.where(domain: domains)
 | 
			
		||||
        else
 | 
			
		||||
          say('No domain given', :red)
 | 
			
		||||
          say('No domain(s) given', :red)
 | 
			
		||||
          exit(1)
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
@@ -45,11 +45,11 @@ module Mastodon
 | 
			
		||||
        SuspendAccountService.new.call(account, reserve_username: false, skip_side_effects: true) unless options[:dry_run]
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      DomainBlock.where(domain: domain).destroy_all unless options[:dry_run]
 | 
			
		||||
      DomainBlock.where(domain: domains).destroy_all unless options[:dry_run]
 | 
			
		||||
 | 
			
		||||
      say("Removed #{processed} accounts#{dry_run}", :green)
 | 
			
		||||
 | 
			
		||||
      custom_emojis = CustomEmoji.where(domain: domain)
 | 
			
		||||
      custom_emojis = CustomEmoji.where(domain: domains)
 | 
			
		||||
      custom_emojis_count = custom_emojis.count
 | 
			
		||||
      custom_emojis.destroy_all unless options[:dry_run]
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -6,6 +6,7 @@ require_relative 'cli_helper'
 | 
			
		||||
 | 
			
		||||
module Mastodon
 | 
			
		||||
  class SearchCLI < Thor
 | 
			
		||||
    option :processes, default: 2, aliases: [:p]
 | 
			
		||||
    desc 'deploy', 'Create or update an ElasticSearch index and populate it'
 | 
			
		||||
    long_desc <<~LONG_DESC
 | 
			
		||||
      If ElasticSearch is empty, this command will create the necessary indices
 | 
			
		||||
@@ -13,10 +14,28 @@ module Mastodon
 | 
			
		||||
 | 
			
		||||
      This command will also upgrade indices if the underlying schema has been
 | 
			
		||||
      changed since the last run.
 | 
			
		||||
 | 
			
		||||
      With the --processes option, parallelize execution of the command. The
 | 
			
		||||
      default is 2. If "auto" is specified, the number is automatically
 | 
			
		||||
      derived from available CPUs.
 | 
			
		||||
    LONG_DESC
 | 
			
		||||
    def deploy
 | 
			
		||||
      processed = Chewy::RakeHelper.upgrade
 | 
			
		||||
      Chewy::RakeHelper.sync(except: processed)
 | 
			
		||||
      processed = Chewy::RakeHelper.upgrade(parallel: processes)
 | 
			
		||||
      Chewy::RakeHelper.sync(except: processed, parallel: processes)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    private
 | 
			
		||||
 | 
			
		||||
    def processes
 | 
			
		||||
      return true if options[:processes] == 'auto'
 | 
			
		||||
 | 
			
		||||
      num = options[:processes].to_i
 | 
			
		||||
 | 
			
		||||
      if num < 2
 | 
			
		||||
        nil
 | 
			
		||||
      else
 | 
			
		||||
        num
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 
 | 
			
		||||
@@ -17,7 +17,7 @@ module Mastodon
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def flags
 | 
			
		||||
      'rc2'
 | 
			
		||||
      'rc3'
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def suffix
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user