diff --git a/app/javascript/gabsocial/actions/statuses.js b/app/javascript/gabsocial/actions/statuses.js index 090569e4..e43223f6 100644 --- a/app/javascript/gabsocial/actions/statuses.js +++ b/app/javascript/gabsocial/actions/statuses.js @@ -29,7 +29,7 @@ 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 const STATUS_EDIT = 'STATUS_EDIT'; export function fetchStatusRequest(id, skipLoading) { return { @@ -132,19 +132,10 @@ export function fetchStatusFail(id, error, skipLoading) { }; }; -export function redraft(status, raw_text) { - return { - type: REDRAFT, - status, - raw_text, - }; -}; - export function editStatus(status) { return dispatch => { dispatch({ - type: REDRAFT, - edit: true, + type: STATUS_EDIT, status, }); @@ -152,7 +143,7 @@ export function editStatus(status) { }; }; -export function deleteStatus(id, routerHistory, withRedraft = false) { +export function deleteStatus(id, routerHistory) { return (dispatch, getState) => { if (!me) return; @@ -168,11 +159,6 @@ export function deleteStatus(id, routerHistory, withRedraft = false) { evictStatus(id); dispatch(deleteStatusSuccess(id)); dispatch(deleteFromTimelines(id)); - - if (withRedraft) { - dispatch(redraft(status, response.data.text)); - dispatch(openModal('COMPOSE')); - } }).catch(error => { dispatch(deleteStatusFail(id, error)); }); diff --git a/app/javascript/gabsocial/components/status_action_bar.js b/app/javascript/gabsocial/components/status_action_bar.js index 0fc9ac48..49e32218 100644 --- a/app/javascript/gabsocial/components/status_action_bar.js +++ b/app/javascript/gabsocial/components/status_action_bar.js @@ -13,7 +13,6 @@ import { Link } from 'react-router-dom'; const messages = defineMessages({ delete: { id: 'status.delete', defaultMessage: 'Delete' }, - redraft: { id: 'status.redraft', defaultMessage: 'Delete & re-draft' }, edit: { id: 'status.edit', defaultMessage: 'Edit' }, direct: { id: 'status.direct', defaultMessage: 'Direct message @{name}' }, mention: { id: 'status.mention', defaultMessage: 'Mention @{name}' }, @@ -113,10 +112,6 @@ class StatusActionBar extends ImmutablePureComponent { this.props.onDelete(this.props.status, this.context.router.history); } - handleRedraftClick = () => { - this.props.onDelete(this.props.status, this.context.router.history, true); - } - handleEditClick = () => { this.props.onEdit(this.props.status); } @@ -222,7 +217,6 @@ class StatusActionBar extends ImmutablePureComponent { } menu.push({ text: intl.formatMessage(messages.delete), action: this.handleDeleteClick }); - // menu.push({ text: intl.formatMessage(messages.redraft), action: this.handleRedraftClick }); menu.push({ text: intl.formatMessage(messages.edit), action: this.handleEditClick }); } else { menu.push({ text: intl.formatMessage(messages.mention, { name: status.getIn(['account', 'username']) }), action: this.handleMentionClick }); diff --git a/app/javascript/gabsocial/containers/status_container.js b/app/javascript/gabsocial/containers/status_container.js index 7a4b41bb..847ae787 100644 --- a/app/javascript/gabsocial/containers/status_container.js +++ b/app/javascript/gabsocial/containers/status_container.js @@ -39,8 +39,6 @@ import { 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? Favorites and reposts will be lost, and replies to the original post will be orphaned.' }, blockConfirm: { id: 'confirmations.block.confirm', defaultMessage: 'Block' }, replyConfirm: { id: 'confirmations.reply.confirm', defaultMessage: 'Reply' }, replyMessage: { id: 'confirmations.reply.message', defaultMessage: 'Replying now will overwrite the message you are currently composing. Are you sure you want to proceed?' }, @@ -130,14 +128,14 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ })); }, - onDelete (status, history, withRedraft = false) { + onDelete (status, history) { if (!deleteModal) { - dispatch(deleteStatus(status.get('id'), history, withRedraft)); + dispatch(deleteStatus(status.get('id'), history)); } else { dispatch(openModal('CONFIRM', { - message: intl.formatMessage(withRedraft ? messages.redraftMessage : messages.deleteMessage), - confirm: intl.formatMessage(withRedraft ? messages.redraftConfirm : messages.deleteConfirm), - onConfirm: () => dispatch(deleteStatus(status.get('id'), history, withRedraft)), + message: intl.formatMessage(messages.deleteMessage), + confirm: intl.formatMessage(messages.deleteConfirm), + onConfirm: () => dispatch(deleteStatus(status.get('id'), history)), })); } }, diff --git a/app/javascript/gabsocial/features/status/components/action_bar.js b/app/javascript/gabsocial/features/status/components/action_bar.js index 0d0705b2..f3de8aab 100644 --- a/app/javascript/gabsocial/features/status/components/action_bar.js +++ b/app/javascript/gabsocial/features/status/components/action_bar.js @@ -10,7 +10,6 @@ import { me, isStaff } from '../../../initial_state'; const messages = defineMessages({ delete: { id: 'status.delete', defaultMessage: 'Delete' }, - redraft: { id: 'status.redraft', defaultMessage: 'Delete & re-draft' }, edit: { id: 'status.edit', defaultMessage: 'Edit' }, direct: { id: 'status.direct', defaultMessage: 'Direct message @{name}' }, mention: { id: 'status.mention', defaultMessage: 'Mention @{name}' }, @@ -107,10 +106,6 @@ class ActionBar extends React.PureComponent { this.props.onEdit(this.props.status); } - handleRedraftClick = () => { - this.props.onDelete(this.props.status, this.context.router.history, true); - } - handleDirectClick = () => { this.props.onDirect(this.props.status.get('account'), this.context.router.history); } @@ -196,7 +191,6 @@ class ActionBar extends React.PureComponent { menu.push({ text: intl.formatMessage(mutingConversation ? messages.unmuteConversation : messages.muteConversation), action: this.handleConversationMuteClick }); menu.push(null); menu.push({ text: intl.formatMessage(messages.delete), action: this.handleDeleteClick }); - // menu.push({ text: intl.formatMessage(messages.redraft), action: this.handleRedraftClick }); menu.push({ text: intl.formatMessage(messages.edit), action: this.handleEditClick }); } else { menu.push({ text: intl.formatMessage(messages.mention, { name: status.getIn(['account', 'username']) }), action: this.handleMentionClick }); diff --git a/app/javascript/gabsocial/features/status/containers/detailed_status_container.js b/app/javascript/gabsocial/features/status/containers/detailed_status_container.js index de5fbeb7..cd057a51 100644 --- a/app/javascript/gabsocial/features/status/containers/detailed_status_container.js +++ b/app/javascript/gabsocial/features/status/containers/detailed_status_container.js @@ -33,8 +33,6 @@ 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? Favorites and reposts will be lost, and replies to the original post will be orphaned.' }, blockConfirm: { id: 'confirmations.block.confirm', defaultMessage: 'Block' }, replyConfirm: { id: 'confirmations.reply.confirm', defaultMessage: 'Reply' }, replyMessage: { id: 'confirmations.reply.message', defaultMessage: 'Replying now will overwrite the message you are currently composing. Are you sure you want to proceed?' }, @@ -108,14 +106,14 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ })); }, - onDelete (status, history, withRedraft = false) { + onDelete (status, history) { if (!deleteModal) { - dispatch(deleteStatus(status.get('id'), history, withRedraft)); + dispatch(deleteStatus(status.get('id'), history)); } else { dispatch(openModal('CONFIRM', { - message: intl.formatMessage(withRedraft ? messages.redraftMessage : messages.deleteMessage), - confirm: intl.formatMessage(withRedraft ? messages.redraftConfirm : messages.deleteConfirm), - onConfirm: () => dispatch(deleteStatus(status.get('id'), history, withRedraft)), + message: intl.formatMessage(messages.deleteMessage), + confirm: intl.formatMessage(messages.deleteConfirm), + onConfirm: () => dispatch(deleteStatus(status.get('id'), history)), })); } }, diff --git a/app/javascript/gabsocial/features/status/index.js b/app/javascript/gabsocial/features/status/index.js index 08663554..e4dd8f06 100644 --- a/app/javascript/gabsocial/features/status/index.js +++ b/app/javascript/gabsocial/features/status/index.js @@ -48,8 +48,6 @@ import Icon from 'gabsocial/components/icon'; 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? Favorites and reposts will be lost, and replies to the original post will be orphaned.' }, blockConfirm: { id: 'confirmations.block.confirm', defaultMessage: 'Block' }, revealAll: { id: 'status.show_more_all', defaultMessage: 'Show more for all' }, hideAll: { id: 'status.show_less_all', defaultMessage: 'Show less for all' }, @@ -224,16 +222,16 @@ class Status extends ImmutablePureComponent { } } - handleDeleteClick = (status, history, withRedraft = false) => { + handleDeleteClick = (status, history) => { const { dispatch, intl } = this.props; if (!deleteModal) { - dispatch(deleteStatus(status.get('id'), history, withRedraft)); + dispatch(deleteStatus(status.get('id'), history)); } else { dispatch(openModal('CONFIRM', { - message: intl.formatMessage(withRedraft ? messages.redraftMessage : messages.deleteMessage), - confirm: intl.formatMessage(withRedraft ? messages.redraftConfirm : messages.deleteConfirm), - onConfirm: () => dispatch(deleteStatus(status.get('id'), history, withRedraft)), + message: intl.formatMessage(messages.deleteMessage), + confirm: intl.formatMessage(messages.deleteConfirm), + onConfirm: () => dispatch(deleteStatus(status.get('id'), history)), })); } } diff --git a/app/javascript/gabsocial/reducers/compose.js b/app/javascript/gabsocial/reducers/compose.js index c9fa7005..66d1f14f 100644 --- a/app/javascript/gabsocial/reducers/compose.js +++ b/app/javascript/gabsocial/reducers/compose.js @@ -39,7 +39,7 @@ import { } from '../actions/compose'; import { TIMELINE_DELETE } from '../actions/timelines'; import { STORE_HYDRATE } from '../actions/store'; -import { REDRAFT } from '../actions/statuses'; +import { STATUS_EDIT } from '../actions/statuses'; import { Map as ImmutableMap, List as ImmutableList, OrderedSet as ImmutableOrderedSet, fromJS } from 'immutable'; import uuid from '../uuid'; import { me } from '../initial_state'; @@ -354,12 +354,9 @@ export default function compose(state = initialState, action) { return item; })); - case REDRAFT: + case STATUS_EDIT: return state.withMutations(map => { - if (action.edit === true) { - map.set('id', action.status.get('id')); - } - + map.set('id', action.status.get('id')); map.set('text', action.raw_text || unescapeHTML(expandMentions(action.status))); map.set('in_reply_to', action.status.get('in_reply_to_id')); map.set('quote_of_id', action.status.get('quote_of_id'));