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 --- app/controllers/settings/preferences_controller.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'app/controllers/settings/preferences_controller.rb') diff --git a/app/controllers/settings/preferences_controller.rb b/app/controllers/settings/preferences_controller.rb index c758e4ef2..f66eb9752 100644 --- a/app/controllers/settings/preferences_controller.rb +++ b/app/controllers/settings/preferences_controller.rb @@ -24,8 +24,9 @@ class Settings::PreferencesController < ApplicationController current_user.settings['default_privacy'] = user_params[:setting_default_privacy] current_user.settings['boost_modal'] = user_params[:setting_boost_modal] == '1' + current_user.settings['auto_play_gif'] = user_params[:setting_auto_play_gif] == '1' - if current_user.update(user_params.except(:notification_emails, :interactions, :setting_default_privacy, :setting_boost_modal)) + if current_user.update(user_params.except(:notification_emails, :interactions, :setting_default_privacy, :setting_boost_modal, :setting_auto_play_gif)) redirect_to settings_preferences_path, notice: I18n.t('generic.changes_saved_msg') else render action: :show @@ -35,6 +36,6 @@ class Settings::PreferencesController < ApplicationController private def user_params - params.require(:user).permit(:locale, :setting_default_privacy, :setting_boost_modal, notification_emails: [:follow, :follow_request, :reblog, :favourite, :mention, :digest], interactions: [:must_be_follower, :must_be_following]) + params.require(:user).permit(:locale, :setting_default_privacy, :setting_boost_modal, :setting_auto_play_gif, notification_emails: [:follow, :follow_request, :reblog, :favourite, :mention, :digest], interactions: [:must_be_follower, :must_be_following]) end end -- cgit From 42d54dc9ea8c6e73008c4400a2d154f0e6bdd384 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 18 Apr 2017 01:57:50 +0200 Subject: Adjust visuals of non-autoplaying GIFV --- .../components/components/media_gallery.jsx | 34 ++++++++++------------ .../features/account/components/header.jsx | 7 ++--- app/assets/stylesheets/components.scss | 31 ++++++++++++++++++++ app/controllers/settings/preferences_controller.rb | 4 +-- 4 files changed, 52 insertions(+), 24 deletions(-) (limited to 'app/controllers/settings/preferences_controller.rb') diff --git a/app/assets/javascripts/components/components/media_gallery.jsx b/app/assets/javascripts/components/components/media_gallery.jsx index c6c726a4e..f334af9cf 100644 --- a/app/assets/javascripts/components/components/media_gallery.jsx +++ b/app/assets/javascripts/components/components/media_gallery.jsx @@ -159,24 +159,22 @@ const Item = React.createClass({ /> ); } else if (attachment.get('type') === 'gifv') { - if (isIOS() || !this.props.autoPlayGif) { - return ( -
-
-
- ); - } else { - thumbnail = ( -