Add rake task for clearing out media from silenced accounts
This commit is contained in:
		
							parent
							
								
									4a2ee43e80
								
							
						
					
					
						commit
						8f54a8851a
					
				
					 1 changed files with 5 additions and 0 deletions
				
			
		| 
						 | 
					@ -6,6 +6,11 @@ namespace :mastodon do
 | 
				
			||||||
    task clear: :environment do
 | 
					    task clear: :environment do
 | 
				
			||||||
      MediaAttachment.where(status_id: nil).where('created_at < ?', 1.day.ago).find_each(&:destroy)
 | 
					      MediaAttachment.where(status_id: nil).where('created_at < ?', 1.day.ago).find_each(&:destroy)
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    desc 'Remove media attachments attributed to silenced accounts'
 | 
				
			||||||
 | 
					    task remove_silenced: :environment do
 | 
				
			||||||
 | 
					      MediaAttachment.where(account: Account.silenced).find_each(&:destroy)
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  namespace :push do
 | 
					  namespace :push do
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue