Add redraft function (#7735)
* Add redraft function Fix #7010 * Add explicit confirmation * Add explicit confirmation message
This commit is contained in:
		@@ -29,6 +29,8 @@ export const STATUS_UNMUTE_FAIL    = 'STATUS_UNMUTE_FAIL';
 | 
			
		||||
export const STATUS_REVEAL = 'STATUS_REVEAL';
 | 
			
		||||
export const STATUS_HIDE   = 'STATUS_HIDE';
 | 
			
		||||
 | 
			
		||||
export const REDRAFT = 'REDRAFT';
 | 
			
		||||
 | 
			
		||||
export function fetchStatusRequest(id, skipLoading) {
 | 
			
		||||
  return {
 | 
			
		||||
    type: STATUS_FETCH_REQUEST,
 | 
			
		||||
@@ -131,14 +133,27 @@ export function fetchStatusFail(id, error, skipLoading) {
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export function deleteStatus(id) {
 | 
			
		||||
export function redraft(status) {
 | 
			
		||||
  return {
 | 
			
		||||
    type: REDRAFT,
 | 
			
		||||
    status,
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export function deleteStatus(id, withRedraft = false) {
 | 
			
		||||
  return (dispatch, getState) => {
 | 
			
		||||
    const status = getState().getIn(['statuses', id]);
 | 
			
		||||
 | 
			
		||||
    dispatch(deleteStatusRequest(id));
 | 
			
		||||
 | 
			
		||||
    api(getState).delete(`/api/v1/statuses/${id}`).then(() => {
 | 
			
		||||
      evictStatus(id);
 | 
			
		||||
      dispatch(deleteStatusSuccess(id));
 | 
			
		||||
      dispatch(deleteFromTimelines(id));
 | 
			
		||||
 | 
			
		||||
      if (withRedraft) {
 | 
			
		||||
        dispatch(redraft(status));
 | 
			
		||||
      }
 | 
			
		||||
    }).catch(error => {
 | 
			
		||||
      dispatch(deleteStatusFail(id, error));
 | 
			
		||||
    });
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user