[Glitch] Add confirm modal for unboosting toots
Port fe8a8f779e36e25286b6a7ddc7bcd08e2a4e2890 to glitch-soc Signed-off-by: Thibaut Girka <thib@sitedethib.com>
This commit is contained in:
		
							parent
							
								
									68629f2773
								
							
						
					
					
						commit
						96f0747afe
					
				@ -88,19 +88,19 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  onModalReblog (status) {
 | 
					  onModalReblog (status) {
 | 
				
			||||||
    dispatch(reblog(status));
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  onReblog (status, e) {
 | 
					 | 
				
			||||||
    if (status.get('reblogged')) {
 | 
					    if (status.get('reblogged')) {
 | 
				
			||||||
      dispatch(unreblog(status));
 | 
					      dispatch(unreblog(status));
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
 | 
					      dispatch(reblog(status));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  onReblog (status, e) {
 | 
				
			||||||
    if (e.shiftKey || !boostModal) {
 | 
					    if (e.shiftKey || !boostModal) {
 | 
				
			||||||
      this.onModalReblog(status);
 | 
					      this.onModalReblog(status);
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      dispatch(openModal('BOOST', { status, onReblog: this.onModalReblog }));
 | 
					      dispatch(openModal('BOOST', { status, onReblog: this.onModalReblog }));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  onBookmark (status) {
 | 
					  onBookmark (status) {
 | 
				
			||||||
 | 
				
			|||||||
@ -10,6 +10,7 @@ import DisplayName from 'flavours/glitch/components/display_name';
 | 
				
			|||||||
import ImmutablePureComponent from 'react-immutable-pure-component';
 | 
					import ImmutablePureComponent from 'react-immutable-pure-component';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const messages = defineMessages({
 | 
					const messages = defineMessages({
 | 
				
			||||||
 | 
					  cancel_reblog: { id: 'status.cancel_reblog_private', defaultMessage: 'Unboost' },
 | 
				
			||||||
  reblog: { id: 'status.reblog', defaultMessage: 'Boost' },
 | 
					  reblog: { id: 'status.reblog', defaultMessage: 'Boost' },
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -52,6 +53,7 @@ export default class BoostModal extends ImmutablePureComponent {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  render () {
 | 
					  render () {
 | 
				
			||||||
    const { status, intl } = this.props;
 | 
					    const { status, intl } = this.props;
 | 
				
			||||||
 | 
					    const buttonText = status.get('reblogged') ? messages.cancel_reblog : messages.reblog;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return (
 | 
					    return (
 | 
				
			||||||
      <div className='modal-root__modal boost-modal'>
 | 
					      <div className='modal-root__modal boost-modal'>
 | 
				
			||||||
@ -77,7 +79,7 @@ export default class BoostModal extends ImmutablePureComponent {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        <div className='boost-modal__action-bar'>
 | 
					        <div className='boost-modal__action-bar'>
 | 
				
			||||||
          <div><FormattedMessage id='boost_modal.combo' defaultMessage='You can press {combo} to skip this next time' values={{ combo: <span>Shift + <i className='fa fa-retweet' /></span> }} /></div>
 | 
					          <div><FormattedMessage id='boost_modal.combo' defaultMessage='You can press {combo} to skip this next time' values={{ combo: <span>Shift + <i className='fa fa-retweet' /></span> }} /></div>
 | 
				
			||||||
          <Button text={intl.formatMessage(messages.reblog)} onClick={this.handleReblog} ref={this.setRef} />
 | 
					          <Button text={intl.formatMessage(buttonText)} onClick={this.handleReblog} ref={this.setRef} />
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user