From ffb99325cafb5b00ee652c6b3ed2811a4d643fc8 Mon Sep 17 00:00:00 2001 From: Patrick Figel Date: Mon, 17 Apr 2017 12:14:03 +0200 Subject: Add gif auto-play/pause preference This introduces a new per-user preference called "Auto-play animated GIFs", which is enabled by default. When a user disables this setting, gifs in toots become click-to-play. Previews of animated gifs were changed to display the video play button so that users can distinguish them from regular images. This setting also affects account avatars in the detailed account view, which was changed to use the same hover-to-play mechanism that is used for animated avatars in timelines. Fixes #1652 --- .../components/components/media_gallery.jsx | 36 ++++++++++++++-------- .../javascripts/components/components/status.jsx | 3 +- .../components/containers/status_container.jsx | 3 +- .../features/account/components/header.jsx | 23 ++++++++++---- .../features/status/components/detailed_status.jsx | 3 +- .../components/features/status/index.jsx | 10 +++--- app/controllers/settings/preferences_controller.rb | 5 +-- app/models/user.rb | 4 +++ app/views/home/initial_state.json.rabl | 1 + app/views/settings/preferences/show.html.haml | 3 ++ 10 files changed, 63 insertions(+), 28 deletions(-) (limited to 'app') diff --git a/app/assets/javascripts/components/components/media_gallery.jsx b/app/assets/javascripts/components/components/media_gallery.jsx index 325fd8157..c6c726a4e 100644 --- a/app/assets/javascripts/components/components/media_gallery.jsx +++ b/app/assets/javascripts/components/components/media_gallery.jsx @@ -78,7 +78,8 @@ const Item = React.createClass({ attachment: ImmutablePropTypes.map.isRequired, index: React.PropTypes.number.isRequired, size: React.PropTypes.number.isRequired, - onClick: React.PropTypes.func.isRequired + onClick: React.PropTypes.func.isRequired, + autoPlayGif: React.PropTypes.bool.isRequired }, mixins: [PureRenderMixin], @@ -158,16 +159,24 @@ const Item = React.createClass({ /> ); } else if (attachment.get('type') === 'gifv') { - thumbnail = ( -