Add redraft function (#7735)
* Add redraft function Fix #7010 * Add explicit confirmation * Add explicit confirmation message
This commit is contained in:
		
					parent
					
						
							
								5fb013878f
							
						
					
				
			
			
				commit
				
					
						bd0791d800
					
				
			
		
					 7 changed files with 74 additions and 12 deletions
				
			
		|  | @ -33,6 +33,8 @@ import { showAlertForError } from '../actions/alerts'; | |||
| const messages = defineMessages({ | ||||
|   deleteConfirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' }, | ||||
|   deleteMessage: { id: 'confirmations.delete.message', defaultMessage: 'Are you sure you want to delete this status?' }, | ||||
|   redraftConfirm: { id: 'confirmations.redraft.confirm', defaultMessage: 'Delete & redraft' }, | ||||
|   redraftMessage: { id: 'confirmations.redraft.message', defaultMessage: 'Are you sure you want to delete this status and re-draft it? You will lose all replies, boosts and favourites to it.' }, | ||||
|   blockConfirm: { id: 'confirmations.block.confirm', defaultMessage: 'Block' }, | ||||
| }); | ||||
| 
 | ||||
|  | @ -91,14 +93,14 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ | |||
|     })); | ||||
|   }, | ||||
| 
 | ||||
|   onDelete (status) { | ||||
|   onDelete (status, withRedraft = false) { | ||||
|     if (!deleteModal) { | ||||
|       dispatch(deleteStatus(status.get('id'))); | ||||
|       dispatch(deleteStatus(status.get('id'), withRedraft)); | ||||
|     } else { | ||||
|       dispatch(openModal('CONFIRM', { | ||||
|         message: intl.formatMessage(messages.deleteMessage), | ||||
|         confirm: intl.formatMessage(messages.deleteConfirm), | ||||
|         onConfirm: () => dispatch(deleteStatus(status.get('id'))), | ||||
|         message: intl.formatMessage(withRedraft ? messages.redraftMessage : messages.deleteMessage), | ||||
|         confirm: intl.formatMessage(withRedraft ? messages.redraftConfirm : messages.deleteConfirm), | ||||
|         onConfirm: () => dispatch(deleteStatus(status.get('id'), withRedraft)), | ||||
|       })); | ||||
|     } | ||||
|   }, | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue