-
+
@{account.get('acct')} {lockedIcon}
@@ -134,4 +144,4 @@ const Header = React.createClass({
});
-export default injectIntl(Header);
+export default connect(makeMapStateToProps)(injectIntl(Header));
diff --git a/app/assets/javascripts/components/features/status/components/detailed_status.jsx b/app/assets/javascripts/components/features/status/components/detailed_status.jsx
index ceafc1a32..bd386b251 100644
--- a/app/assets/javascripts/components/features/status/components/detailed_status.jsx
+++ b/app/assets/javascripts/components/features/status/components/detailed_status.jsx
@@ -19,6 +19,7 @@ const DetailedStatus = React.createClass({
status: ImmutablePropTypes.map.isRequired,
onOpenMedia: React.PropTypes.func.isRequired,
onOpenVideo: React.PropTypes.func.isRequired,
+ autoPlayGif: React.PropTypes.bool,
},
mixins: [PureRenderMixin],
@@ -42,7 +43,7 @@ const DetailedStatus = React.createClass({
if (status.getIn(['media_attachments', 0, 'type']) === 'video') {
media =
;
} else {
- media =
;
+ media =
;
}
} else {
media =
;
diff --git a/app/assets/javascripts/components/features/status/index.jsx b/app/assets/javascripts/components/features/status/index.jsx
index 7ead68807..ca6e08cdc 100644
--- a/app/assets/javascripts/components/features/status/index.jsx
+++ b/app/assets/javascripts/components/features/status/index.jsx
@@ -39,7 +39,8 @@ const makeMapStateToProps = () => {
ancestorsIds: state.getIn(['timelines', 'ancestors', Number(props.params.statusId)]),
descendantsIds: state.getIn(['timelines', 'descendants', Number(props.params.statusId)]),
me: state.getIn(['meta', 'me']),
- boostModal: state.getIn(['meta', 'boost_modal'])
+ boostModal: state.getIn(['meta', 'boost_modal']),
+ autoPlayGif: state.getIn(['meta', 'auto_play_gif'])
});
return mapStateToProps;
@@ -57,7 +58,8 @@ const Status = React.createClass({
ancestorsIds: ImmutablePropTypes.list,
descendantsIds: ImmutablePropTypes.list,
me: React.PropTypes.number,
- boostModal: React.PropTypes.bool
+ boostModal: React.PropTypes.bool,
+ autoPlayGif: React.PropTypes.bool
},
mixins: [PureRenderMixin],
@@ -126,7 +128,7 @@ const Status = React.createClass({
render () {
let ancestors, descendants;
- const { status, ancestorsIds, descendantsIds, me } = this.props;
+ const { status, ancestorsIds, descendantsIds, me, autoPlayGif } = this.props;
if (status === null) {
return (
@@ -155,7 +157,7 @@ const Status = React.createClass({
{ancestors}
-
+
{descendants}
diff --git a/app/assets/stylesheets/components.scss b/app/assets/stylesheets/components.scss
index 6f407a6d5..b646b0c77 100644
--- a/app/assets/stylesheets/components.scss
+++ b/app/assets/stylesheets/components.scss
@@ -2315,3 +2315,34 @@ button.icon-button.active i.fa-retweet {
top: 0;
left: 0;
}
+
+.media-gallery__gifv__label {
+ display: block;
+ position: absolute;
+ color: $color5;
+ background: rgba($color8, 0.5);
+ bottom: 6px;
+ left: 6px;
+ padding: 2px 6px;
+ border-radius: 2px;
+ font-size: 11px;
+ font-weight: 600;
+ z-index: 1;
+ pointer-events: none;
+ opacity: 0.9;
+ transition: opacity 0.1s ease;
+}
+
+.media-gallery__gifv {
+ &.autoplay {
+ .media-gallery__gifv__label {
+ display: none;
+ }
+ }
+
+ &:hover {
+ .media-gallery__gifv__label {
+ opacity: 1;
+ }
+ }
+}
diff --git a/app/controllers/settings/preferences_controller.rb b/app/controllers/settings/preferences_controller.rb
index c758e4ef2..5d8cb7628 100644
--- a/app/controllers/settings/preferences_controller.rb
+++ b/app/controllers/settings/preferences_controller.rb
@@ -23,9 +23,10 @@ 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['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
diff --git a/app/models/user.rb b/app/models/user.rb
index 110b52aa9..cd1f816ca 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -30,4 +30,8 @@ class User < ApplicationRecord
def setting_boost_modal
settings.boost_modal
end
+
+ def setting_auto_play_gif
+ settings.auto_play_gif
+ end
end
diff --git a/app/views/home/initial_state.json.rabl b/app/views/home/initial_state.json.rabl
index 104049387..b599b5cf0 100644
--- a/app/views/home/initial_state.json.rabl
+++ b/app/views/home/initial_state.json.rabl
@@ -9,6 +9,7 @@ node(:meta) do
me: current_account.id,
admin: @admin.try(:id),
boost_modal: current_account.user.setting_boost_modal,
+ auto_play_gif: current_account.user.setting_auto_play_gif,
}
end
diff --git a/app/views/settings/preferences/show.html.haml b/app/views/settings/preferences/show.html.haml
index 4f4326763..ce3929629 100644
--- a/app/views/settings/preferences/show.html.haml
+++ b/app/views/settings/preferences/show.html.haml
@@ -25,5 +25,8 @@
.fields-group
= f.input :setting_boost_modal, as: :boolean, wrapper: :with_label
+ .fields-group
+ = f.input :setting_auto_play_gif, as: :boolean, wrapper: :with_label
+
.actions
= f.button :button, t('generic.save_changes'), type: :submit
diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml
index c25407f2b..5335b0927 100644
--- a/config/locales/simple_form.en.yml
+++ b/config/locales/simple_form.en.yml
@@ -28,6 +28,7 @@ en:
note: Bio
otp_attempt: Two-factor code
password: Password
+ setting_auto_play_gif: Auto-play animated GIFs
setting_boost_modal: Show confirmation dialog before boosting
setting_default_privacy: Post privacy
severity: Severity
diff --git a/config/settings.yml b/config/settings.yml
index 04213fd0b..9813963b2 100644
--- a/config/settings.yml
+++ b/config/settings.yml
@@ -15,6 +15,7 @@ defaults: &defaults
open_registrations: true
closed_registrations_message: ''
boost_modal: false
+ auto_play_gif: true
notification_emails:
follow: false
reblog: false