about summary refs log tree commit diff
path: root/app/views
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 /app/views
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 'app/views')
-rw-r--r--app/views/api/v1/accounts/show.rabl11
1 files changed, 6 insertions, 5 deletions
diff --git a/app/views/api/v1/accounts/show.rabl b/app/views/api/v1/accounts/show.rabl
index 32df0457a..8826aa22d 100644
--- a/app/views/api/v1/accounts/show.rabl
+++ b/app/views/api/v1/accounts/show.rabl
@@ -4,8 +4,9 @@ attributes :id, :username, :acct, :display_name, :locked, :created_at
 
 node(:note)            { |account| Formatter.instance.simplified_format(account) }
 node(:url)             { |account| TagManager.instance.url_for(account) }
-node(:avatar)          { |account| full_asset_url(account.avatar.url(:original)) }
-node(:header)          { |account| full_asset_url(account.header.url(:original)) }
-node(:followers_count) { |account| defined?(@followers_counts_map) ? (@followers_counts_map[account.id] || 0) : account.followers_count }
-node(:following_count) { |account| defined?(@following_counts_map) ? (@following_counts_map[account.id] || 0) : account.following_count }
-node(:statuses_count)  { |account| defined?(@statuses_counts_map)  ? (@statuses_counts_map[account.id]  || 0) : account.statuses_count }
+node(:avatar)          { |account| full_asset_url(account.avatar_original_url) }
+node(:avatar_static)   { |account| full_asset_url(account.avatar_static_url) }
+node(:header)          { |account| full_asset_url(account.header_original_url) }
+node(:header_static)   { |account| full_asset_url(account.header_static_url) }
+
+attributes :followers_count, :following_count, :statuses_count