Bypass boost confirm modal if alt is pressed

lolsob-rspec
blackle 2017-04-11 08:34:14 -04:00
parent 3f5290bdb2
commit e68cde9255
5 changed files with 17 additions and 9 deletions

View File

@ -31,7 +31,7 @@ const IconButton = React.createClass({
e.preventDefault();
if (!this.props.disabled) {
this.props.onClick();
this.props.onClick(e);
}
},

View File

@ -46,8 +46,8 @@ const StatusActionBar = React.createClass({
this.props.onFavourite(this.props.status);
},
handleReblogClick () {
this.props.onReblog(this.props.status);
handleReblogClick (e) {
this.props.onReblog(this.props.status, e);
},
handleDeleteClick () {

View File

@ -42,11 +42,15 @@ const mapDispatchToProps = (dispatch) => ({
dispatch(reblog(status));
},
onReblog (status) {
onReblog (status, e) {
if (status.get('reblogged')) {
dispatch(unreblog(status));
} else {
dispatch(openModal('BOOST', { status, onReblog: this.onModalReblog }));
if (e.altKey) {
this.onModalReblog(status);
} else {
dispatch(openModal('BOOST', { status, onReblog: this.onModalReblog }));
}
}
},

View File

@ -37,8 +37,8 @@ const ActionBar = React.createClass({
this.props.onReply(this.props.status);
},
handleReblogClick () {
this.props.onReblog(this.props.status);
handleReblogClick (e) {
this.props.onReblog(this.props.status, e);
},
handleFavouriteClick () {

View File

@ -86,11 +86,15 @@ const Status = React.createClass({
this.props.dispatch(reblog(status));
},
handleReblogClick (status) {
handleReblogClick (status, e) {
if (status.get('reblogged')) {
this.props.dispatch(unreblog(status));
} else {
this.props.dispatch(openModal('BOOST', { status, onReblog: this.handleModalReblog }));
if (e.altKey) {
this.handleModalReblog(status);
} else {
this.props.dispatch(openModal('BOOST', { status, onReblog: this.handleModalReblog }));
}
}
},