Can be filtered by a specific domain Resolves #2292
This commit is contained in:
parent
f93de3a516
commit
e6c81a635b
3 changed files with 31 additions and 9 deletions
|
@ -22,8 +22,8 @@ module Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
def redownload
|
def redownload
|
||||||
@account.avatar = @account.avatar_remote_url
|
@account.reset_avatar!
|
||||||
@account.header = @account.header_remote_url
|
@account.reset_header!
|
||||||
@account.save!
|
@account.save!
|
||||||
|
|
||||||
redirect_to admin_account_path(@account.id)
|
redirect_to admin_account_path(@account.id)
|
||||||
|
|
|
@ -6,8 +6,9 @@ module Remotable
|
||||||
|
|
||||||
included do
|
included do
|
||||||
attachment_definitions.each_key do |attachment_name|
|
attachment_definitions.each_key do |attachment_name|
|
||||||
attribute_name = "#{attachment_name}_remote_url".to_sym
|
attribute_name = "#{attachment_name}_remote_url".to_sym
|
||||||
method_name = "#{attribute_name}=".to_sym
|
method_name = "#{attribute_name}=".to_sym
|
||||||
|
alt_method_name = "reset_#{attachment_name}!".to_sym
|
||||||
|
|
||||||
define_method method_name do |url|
|
define_method method_name do |url|
|
||||||
begin
|
begin
|
||||||
|
@ -35,6 +36,15 @@ module Remotable
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
define_method alt_method_name do
|
||||||
|
url = self[attribute_name]
|
||||||
|
|
||||||
|
return if url.blank?
|
||||||
|
|
||||||
|
self[attribute_name] = ''
|
||||||
|
send(method_name, url)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -74,7 +74,7 @@ namespace :mastodon do
|
||||||
end
|
end
|
||||||
|
|
||||||
namespace :media do
|
namespace :media do
|
||||||
desc 'Removes media attachments that have not been assigned to any status for longer than a day'
|
desc 'Removes media attachments that have not been assigned to any status for longer than a day (deprecated)'
|
||||||
task clear: :environment do
|
task clear: :environment do
|
||||||
# No-op
|
# No-op
|
||||||
# This task is now executed via sidekiq-scheduler
|
# This task is now executed via sidekiq-scheduler
|
||||||
|
@ -100,6 +100,18 @@ namespace :mastodon do
|
||||||
MediaAttachment.where(file_file_name: nil).where.not(type: :unknown).in_batches.update_all(type: :unknown)
|
MediaAttachment.where(file_file_name: nil).where.not(type: :unknown).in_batches.update_all(type: :unknown)
|
||||||
Rails.logger.debug 'Done!'
|
Rails.logger.debug 'Done!'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc 'Redownload avatars/headers of remote users. Optionally limit to a particular domain with DOMAIN'
|
||||||
|
task redownload_avatars: :environment do
|
||||||
|
accounts = Account.remote
|
||||||
|
accounts = accounts.where(domain: ENV['DOMAIN']) if ENV['DOMAIN'].present?
|
||||||
|
|
||||||
|
accounts.find_each do |account|
|
||||||
|
account.reset_avatar!
|
||||||
|
account.reset_header!
|
||||||
|
account.save
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
namespace :push do
|
namespace :push do
|
||||||
|
@ -111,7 +123,7 @@ namespace :mastodon do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
desc 'Re-subscribes to soon expiring PuSH subscriptions'
|
desc 'Re-subscribes to soon expiring PuSH subscriptions (deprecated)'
|
||||||
task refresh: :environment do
|
task refresh: :environment do
|
||||||
# No-op
|
# No-op
|
||||||
# This task is now executed via sidekiq-scheduler
|
# This task is now executed via sidekiq-scheduler
|
||||||
|
@ -119,13 +131,13 @@ namespace :mastodon do
|
||||||
end
|
end
|
||||||
|
|
||||||
namespace :feeds do
|
namespace :feeds do
|
||||||
desc 'Clear timelines of inactive users'
|
desc 'Clear timelines of inactive users (deprecated)'
|
||||||
task clear: :environment do
|
task clear: :environment do
|
||||||
# No-op
|
# No-op
|
||||||
# This task is now executed via sidekiq-scheduler
|
# This task is now executed via sidekiq-scheduler
|
||||||
end
|
end
|
||||||
|
|
||||||
desc 'Clears all timelines'
|
desc 'Clear all timelines without regenerating them'
|
||||||
task clear_all: :environment do
|
task clear_all: :environment do
|
||||||
Redis.current.keys('feed:*').each { |key| Redis.current.del(key) }
|
Redis.current.keys('feed:*').each { |key| Redis.current.del(key) }
|
||||||
end
|
end
|
||||||
|
@ -151,7 +163,7 @@ namespace :mastodon do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
desc 'List all admin users'
|
desc 'List e-mails of all admin users'
|
||||||
task admins: :environment do
|
task admins: :environment do
|
||||||
puts 'Admin user emails:'
|
puts 'Admin user emails:'
|
||||||
puts User.admins.map(&:email).join("\n")
|
puts User.admins.map(&:email).join("\n")
|
||||||
|
|
Loading…
Reference in a new issue