about summary refs log tree commit diff
path: root/lib/tasks
diff options
context:
space:
mode:
authorEugen <eugen@zeonfederated.com>2017-04-11 00:38:58 +0200
committerGitHub <noreply@github.com>2017-04-11 00:38:58 +0200
commit12f72e1740cd91929419c82c6b782393e306994c (patch)
tree32cca940d79de94adf447bae3c98f2c4b4c76750 /lib/tasks
parentb57eed4584fbaa3bf83964bda804f27495b6f1fc (diff)
When avatar/header are GIF, generate static versions (#1428)
* When avatar/header are GIF, generate static versions.
Account API returns "avatar"/"avatar_static", "header"/"header_static"
Static version is the same as original for other cases
Web UI de-animates avatars in toots, lists of users

Fix #441, fix #596, prerequisite for #1064

* Fix JS test

* Add rake task to generate static avatars/headers from GIF ones, add test
Diffstat (limited to 'lib/tasks')
-rw-r--r--lib/tasks/mastodon.rake12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/tasks/mastodon.rake b/lib/tasks/mastodon.rake
index 037a13398..a8fb58b7f 100644
--- a/lib/tasks/mastodon.rake
+++ b/lib/tasks/mastodon.rake
@@ -92,5 +92,17 @@ namespace :mastodon do
 
       Rails.logger.debug 'Done!'
     end
+
+    desc 'Generate static versions of GIF avatars/headers'
+    task add_static_avatars: :environment do
+      Rails.logger.debug 'Generating static avatars/headers for GIF ones...'
+
+      Account.unscoped.where(avatar_content_type: 'image/gif').or(Account.unscoped.where(header_content_type: 'image/gif')).find_each do |account|
+        account.avatar.reprocess!
+        account.header.reprocess!
+      end
+
+      Rails.logger.debug 'Done!'
+    end
   end
 end