forked from treehouse/mastodon
Allow user to disable the boost confirm dialog in preferences
parent
f53fb6aa66
commit
06444bf050
|
@ -27,6 +27,7 @@ const Status = React.createClass({
|
||||||
onOpenMedia: React.PropTypes.func,
|
onOpenMedia: React.PropTypes.func,
|
||||||
onBlock: React.PropTypes.func,
|
onBlock: React.PropTypes.func,
|
||||||
me: React.PropTypes.number,
|
me: React.PropTypes.number,
|
||||||
|
boostModal: React.PropTypes.bool,
|
||||||
muted: React.PropTypes.bool
|
muted: React.PropTypes.bool
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,8 @@ const makeMapStateToProps = () => {
|
||||||
|
|
||||||
const mapStateToProps = (state, props) => ({
|
const mapStateToProps = (state, props) => ({
|
||||||
status: getStatus(state, props.id),
|
status: getStatus(state, props.id),
|
||||||
me: state.getIn(['meta', 'me'])
|
me: state.getIn(['meta', 'me']),
|
||||||
|
boostModal: state.getIn(['meta', 'boost_modal'])
|
||||||
});
|
});
|
||||||
|
|
||||||
return mapStateToProps;
|
return mapStateToProps;
|
||||||
|
@ -46,7 +47,7 @@ const mapDispatchToProps = (dispatch) => ({
|
||||||
if (status.get('reblogged')) {
|
if (status.get('reblogged')) {
|
||||||
dispatch(unreblog(status));
|
dispatch(unreblog(status));
|
||||||
} else {
|
} else {
|
||||||
if (e.altKey) {
|
if (e.altKey || !this.boostModal) {
|
||||||
this.onModalReblog(status);
|
this.onModalReblog(status);
|
||||||
} else {
|
} else {
|
||||||
dispatch(openModal('BOOST', { status, onReblog: this.onModalReblog }));
|
dispatch(openModal('BOOST', { status, onReblog: this.onModalReblog }));
|
||||||
|
|
|
@ -38,7 +38,8 @@ const makeMapStateToProps = () => {
|
||||||
status: getStatus(state, Number(props.params.statusId)),
|
status: getStatus(state, Number(props.params.statusId)),
|
||||||
ancestorsIds: state.getIn(['timelines', 'ancestors', Number(props.params.statusId)]),
|
ancestorsIds: state.getIn(['timelines', 'ancestors', Number(props.params.statusId)]),
|
||||||
descendantsIds: state.getIn(['timelines', 'descendants', Number(props.params.statusId)]),
|
descendantsIds: state.getIn(['timelines', 'descendants', Number(props.params.statusId)]),
|
||||||
me: state.getIn(['meta', 'me'])
|
me: state.getIn(['meta', 'me']),
|
||||||
|
boostModal: state.getIn(['meta', 'boost_modal'])
|
||||||
});
|
});
|
||||||
|
|
||||||
return mapStateToProps;
|
return mapStateToProps;
|
||||||
|
@ -55,7 +56,8 @@ const Status = React.createClass({
|
||||||
status: ImmutablePropTypes.map,
|
status: ImmutablePropTypes.map,
|
||||||
ancestorsIds: ImmutablePropTypes.list,
|
ancestorsIds: ImmutablePropTypes.list,
|
||||||
descendantsIds: ImmutablePropTypes.list,
|
descendantsIds: ImmutablePropTypes.list,
|
||||||
me: React.PropTypes.number
|
me: React.PropTypes.number,
|
||||||
|
boostModal: React.PropTypes.bool
|
||||||
},
|
},
|
||||||
|
|
||||||
mixins: [PureRenderMixin],
|
mixins: [PureRenderMixin],
|
||||||
|
@ -90,7 +92,7 @@ const Status = React.createClass({
|
||||||
if (status.get('reblogged')) {
|
if (status.get('reblogged')) {
|
||||||
this.props.dispatch(unreblog(status));
|
this.props.dispatch(unreblog(status));
|
||||||
} else {
|
} else {
|
||||||
if (e.altKey) {
|
if (e.altKey || !this.props.boostModal) {
|
||||||
this.handleModalReblog(status);
|
this.handleModalReblog(status);
|
||||||
} else {
|
} else {
|
||||||
this.props.dispatch(openModal('BOOST', { status, onReblog: this.handleModalReblog }));
|
this.props.dispatch(openModal('BOOST', { status, onReblog: this.handleModalReblog }));
|
||||||
|
|
|
@ -23,8 +23,9 @@ class Settings::PreferencesController < ApplicationController
|
||||||
}
|
}
|
||||||
|
|
||||||
current_user.settings['default_privacy'] = user_params[:setting_default_privacy]
|
current_user.settings['default_privacy'] = user_params[:setting_default_privacy]
|
||||||
|
current_user.settings['boost_modal'] = user_params[:setting_boost_modal] == '1'
|
||||||
|
|
||||||
if current_user.update(user_params.except(:notification_emails, :interactions, :setting_default_privacy))
|
if current_user.update(user_params.except(:notification_emails, :interactions, :setting_default_privacy, :setting_boost_modal))
|
||||||
redirect_to settings_preferences_path, notice: I18n.t('generic.changes_saved_msg')
|
redirect_to settings_preferences_path, notice: I18n.t('generic.changes_saved_msg')
|
||||||
else
|
else
|
||||||
render action: :show
|
render action: :show
|
||||||
|
@ -34,6 +35,6 @@ class Settings::PreferencesController < ApplicationController
|
||||||
private
|
private
|
||||||
|
|
||||||
def user_params
|
def user_params
|
||||||
params.require(:user).permit(:locale, :setting_default_privacy, 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, notification_emails: [:follow, :follow_request, :reblog, :favourite, :mention, :digest], interactions: [:must_be_follower, :must_be_following])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -26,4 +26,8 @@ class User < ApplicationRecord
|
||||||
def setting_default_privacy
|
def setting_default_privacy
|
||||||
settings.default_privacy || (account.locked? ? 'private' : 'public')
|
settings.default_privacy || (account.locked? ? 'private' : 'public')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def setting_boost_modal
|
||||||
|
settings.boost_modal
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,6 +5,7 @@ node(:meta) do
|
||||||
access_token: @token,
|
access_token: @token,
|
||||||
locale: I18n.locale,
|
locale: I18n.locale,
|
||||||
me: current_account.id,
|
me: current_account.id,
|
||||||
|
boost_modal: current_account.user.setting_boost_modal,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -22,5 +22,8 @@
|
||||||
= ff.input :must_be_follower, as: :boolean, wrapper: :with_label
|
= ff.input :must_be_follower, as: :boolean, wrapper: :with_label
|
||||||
= ff.input :must_be_following, as: :boolean, wrapper: :with_label
|
= ff.input :must_be_following, as: :boolean, wrapper: :with_label
|
||||||
|
|
||||||
|
.fields-group
|
||||||
|
= f.input :setting_boost_modal, as: :boolean, wrapper: :with_label
|
||||||
|
|
||||||
.actions
|
.actions
|
||||||
= f.button :button, t('generic.save_changes'), type: :submit
|
= f.button :button, t('generic.save_changes'), type: :submit
|
||||||
|
|
|
@ -29,6 +29,7 @@ en:
|
||||||
setting_default_privacy: Post privacy
|
setting_default_privacy: Post privacy
|
||||||
type: Import type
|
type: Import type
|
||||||
username: Username
|
username: Username
|
||||||
|
setting_boost_modal: Show confirmation dialog before boosting
|
||||||
interactions:
|
interactions:
|
||||||
must_be_follower: Block notifications from non-followers
|
must_be_follower: Block notifications from non-followers
|
||||||
must_be_following: Block notifications from people you don't follow
|
must_be_following: Block notifications from people you don't follow
|
||||||
|
|
|
@ -7,6 +7,7 @@ defaults: &defaults
|
||||||
site_contact_email: ''
|
site_contact_email: ''
|
||||||
open_registrations: true
|
open_registrations: true
|
||||||
closed_registrations_message: ''
|
closed_registrations_message: ''
|
||||||
|
boost_modal: true
|
||||||
notification_emails:
|
notification_emails:
|
||||||
follow: false
|
follow: false
|
||||||
reblog: false
|
reblog: false
|
||||||
|
|
Loading…
Reference in New Issue