1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00

Remove routerHistory parameters from composer actions (#31077)

This commit is contained in:
Claire 2024-07-19 17:26:44 +02:00 committed by GitHub
parent adadfdbc03
commit e768b23aa9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 91 additions and 100 deletions

View file

@ -4,6 +4,7 @@ import axios from 'axios';
import { throttle } from 'lodash'; import { throttle } from 'lodash';
import api from 'mastodon/api'; import api from 'mastodon/api';
import { browserHistory } from 'mastodon/components/router';
import { search as emojiSearch } from 'mastodon/features/emoji/emoji_mart_search_light'; import { search as emojiSearch } from 'mastodon/features/emoji/emoji_mart_search_light';
import { tagHistory } from 'mastodon/settings'; import { tagHistory } from 'mastodon/settings';
@ -88,9 +89,9 @@ const messages = defineMessages({
saved: { id: 'compose.saved.body', defaultMessage: 'Post saved.' }, saved: { id: 'compose.saved.body', defaultMessage: 'Post saved.' },
}); });
export const ensureComposeIsVisible = (getState, routerHistory) => { export const ensureComposeIsVisible = (getState) => {
if (!getState().getIn(['compose', 'mounted'])) { if (!getState().getIn(['compose', 'mounted'])) {
routerHistory.push('/publish'); browserHistory.push('/publish');
} }
}; };
@ -110,14 +111,14 @@ export function changeCompose(text) {
}; };
} }
export function replyCompose(status, routerHistory) { export function replyCompose(status) {
return (dispatch, getState) => { return (dispatch, getState) => {
dispatch({ dispatch({
type: COMPOSE_REPLY, type: COMPOSE_REPLY,
status: status, status: status,
}); });
ensureComposeIsVisible(getState, routerHistory); ensureComposeIsVisible(getState);
}; };
} }
@ -133,38 +134,38 @@ export function resetCompose() {
}; };
} }
export const focusCompose = (routerHistory, defaultText) => (dispatch, getState) => { export const focusCompose = (defaultText) => (dispatch, getState) => {
dispatch({ dispatch({
type: COMPOSE_FOCUS, type: COMPOSE_FOCUS,
defaultText, defaultText,
}); });
ensureComposeIsVisible(getState, routerHistory); ensureComposeIsVisible(getState);
}; };
export function mentionCompose(account, routerHistory) { export function mentionCompose(account) {
return (dispatch, getState) => { return (dispatch, getState) => {
dispatch({ dispatch({
type: COMPOSE_MENTION, type: COMPOSE_MENTION,
account: account, account: account,
}); });
ensureComposeIsVisible(getState, routerHistory); ensureComposeIsVisible(getState);
}; };
} }
export function directCompose(account, routerHistory) { export function directCompose(account) {
return (dispatch, getState) => { return (dispatch, getState) => {
dispatch({ dispatch({
type: COMPOSE_DIRECT, type: COMPOSE_DIRECT,
account: account, account: account,
}); });
ensureComposeIsVisible(getState, routerHistory); ensureComposeIsVisible(getState);
}; };
} }
export function submitCompose(routerHistory) { export function submitCompose() {
return function (dispatch, getState) { return function (dispatch, getState) {
const status = getState().getIn(['compose', 'text'], ''); const status = getState().getIn(['compose', 'text'], '');
const media = getState().getIn(['compose', 'media_attachments']); const media = getState().getIn(['compose', 'media_attachments']);
@ -214,8 +215,8 @@ export function submitCompose(routerHistory) {
'Idempotency-Key': getState().getIn(['compose', 'idempotencyKey']), 'Idempotency-Key': getState().getIn(['compose', 'idempotencyKey']),
}, },
}).then(function (response) { }).then(function (response) {
if (routerHistory && (routerHistory.location.pathname === '/publish' || routerHistory.location.pathname === '/statuses/new') && window.history.state) { if ((browserHistory.location.pathname === '/publish' || browserHistory.location.pathname === '/statuses/new') && window.history.state) {
routerHistory.goBack(); browserHistory.goBack();
} }
dispatch(insertIntoTagHistory(response.data.tags, status)); dispatch(insertIntoTagHistory(response.data.tags, status));
@ -249,7 +250,7 @@ export function submitCompose(routerHistory) {
message: statusId === null ? messages.published : messages.saved, message: statusId === null ? messages.published : messages.saved,
action: messages.open, action: messages.open,
dismissAfter: 10000, dismissAfter: 10000,
onClick: () => routerHistory.push(`/@${response.data.account.username}/${response.data.id}`), onClick: () => browserHistory.push(`/@${response.data.account.username}/${response.data.id}`),
})); }));
}).catch(function (error) { }).catch(function (error) {
dispatch(submitComposeFail(error)); dispatch(submitComposeFail(error));

View file

@ -93,7 +93,7 @@ export function redraft(status, raw_text) {
}; };
} }
export const editStatus = (id, routerHistory) => (dispatch, getState) => { export const editStatus = (id) => (dispatch, getState) => {
let status = getState().getIn(['statuses', id]); let status = getState().getIn(['statuses', id]);
if (status.get('poll')) { if (status.get('poll')) {
@ -104,7 +104,7 @@ export const editStatus = (id, routerHistory) => (dispatch, getState) => {
api().get(`/api/v1/statuses/${id}/source`).then(response => { api().get(`/api/v1/statuses/${id}/source`).then(response => {
dispatch(fetchStatusSourceSuccess()); dispatch(fetchStatusSourceSuccess());
ensureComposeIsVisible(getState, routerHistory); ensureComposeIsVisible(getState);
dispatch(setComposeToStatus(status, response.data.text, response.data.spoiler_text)); dispatch(setComposeToStatus(status, response.data.text, response.data.spoiler_text));
}).catch(error => { }).catch(error => {
dispatch(fetchStatusSourceFail(error)); dispatch(fetchStatusSourceFail(error));
@ -124,7 +124,7 @@ export const fetchStatusSourceFail = error => ({
error, error,
}); });
export function deleteStatus(id, routerHistory, withRedraft = false) { export function deleteStatus(id, withRedraft = false) {
return (dispatch, getState) => { return (dispatch, getState) => {
let status = getState().getIn(['statuses', id]); let status = getState().getIn(['statuses', id]);
@ -141,7 +141,7 @@ export function deleteStatus(id, routerHistory, withRedraft = false) {
if (withRedraft) { if (withRedraft) {
dispatch(redraft(status, response.data.text)); dispatch(redraft(status, response.data.text));
ensureComposeIsVisible(getState, routerHistory); ensureComposeIsVisible(getState);
} }
}).catch(error => { }).catch(error => {
dispatch(deleteStatusFail(id, error)); dispatch(deleteStatusFail(id, error));

View file

@ -22,7 +22,7 @@ type LocationState = MastodonLocationState | null | undefined;
type HistoryPath = Path | LocationDescriptor<LocationState>; type HistoryPath = Path | LocationDescriptor<LocationState>;
const browserHistory = createBrowserHistory<LocationState>(); export const browserHistory = createBrowserHistory<LocationState>();
const originalPush = browserHistory.push.bind(browserHistory); const originalPush = browserHistory.push.bind(browserHistory);
const originalReplace = browserHistory.replace.bind(browserHistory); const originalReplace = browserHistory.replace.bind(browserHistory);

View file

@ -268,7 +268,7 @@ class Status extends ImmutablePureComponent {
handleHotkeyReply = e => { handleHotkeyReply = e => {
e.preventDefault(); e.preventDefault();
this.props.onReply(this._properStatus(), this.props.history); this.props.onReply(this._properStatus());
}; };
handleHotkeyFavourite = () => { handleHotkeyFavourite = () => {
@ -281,7 +281,7 @@ class Status extends ImmutablePureComponent {
handleHotkeyMention = e => { handleHotkeyMention = e => {
e.preventDefault(); e.preventDefault();
this.props.onMention(this._properStatus().get('account'), this.props.history); this.props.onMention(this._properStatus().get('account'));
}; };
handleHotkeyOpen = () => { handleHotkeyOpen = () => {

View file

@ -118,7 +118,7 @@ class StatusActionBar extends ImmutablePureComponent {
const { signedIn } = this.props.identity; const { signedIn } = this.props.identity;
if (signedIn) { if (signedIn) {
this.props.onReply(this.props.status, this.props.history); this.props.onReply(this.props.status);
} else { } else {
this.props.onInteractionModal('reply', this.props.status); this.props.onInteractionModal('reply', this.props.status);
} }
@ -157,15 +157,15 @@ class StatusActionBar extends ImmutablePureComponent {
}; };
handleDeleteClick = () => { handleDeleteClick = () => {
this.props.onDelete(this.props.status, this.props.history); this.props.onDelete(this.props.status);
}; };
handleRedraftClick = () => { handleRedraftClick = () => {
this.props.onDelete(this.props.status, this.props.history, true); this.props.onDelete(this.props.status, true);
}; };
handleEditClick = () => { handleEditClick = () => {
this.props.onEdit(this.props.status, this.props.history); this.props.onEdit(this.props.status);
}; };
handlePinClick = () => { handlePinClick = () => {
@ -173,11 +173,11 @@ class StatusActionBar extends ImmutablePureComponent {
}; };
handleMentionClick = () => { handleMentionClick = () => {
this.props.onMention(this.props.status.get('account'), this.props.history); this.props.onMention(this.props.status.get('account'));
}; };
handleDirectClick = () => { handleDirectClick = () => {
this.props.onDirect(this.props.status.get('account'), this.props.history); this.props.onDirect(this.props.status.get('account'));
}; };
handleMuteClick = () => { handleMuteClick = () => {

View file

@ -76,7 +76,7 @@ const makeMapStateToProps = () => {
const mapDispatchToProps = (dispatch, { intl, contextType }) => ({ const mapDispatchToProps = (dispatch, { intl, contextType }) => ({
onReply (status, router) { onReply (status) {
dispatch((_, getState) => { dispatch((_, getState) => {
let state = getState(); let state = getState();
@ -86,10 +86,10 @@ const mapDispatchToProps = (dispatch, { intl, contextType }) => ({
modalProps: { modalProps: {
message: intl.formatMessage(messages.replyMessage), message: intl.formatMessage(messages.replyMessage),
confirm: intl.formatMessage(messages.replyConfirm), confirm: intl.formatMessage(messages.replyConfirm),
onConfirm: () => dispatch(replyCompose(status, router)) }, onConfirm: () => dispatch(replyCompose(status)) },
})); }));
} else { } else {
dispatch(replyCompose(status, router)); dispatch(replyCompose(status));
} }
}); });
}, },
@ -144,22 +144,22 @@ const mapDispatchToProps = (dispatch, { intl, contextType }) => ({
})); }));
}, },
onDelete (status, history, withRedraft = false) { onDelete (status, withRedraft = false) {
if (!deleteModal) { if (!deleteModal) {
dispatch(deleteStatus(status.get('id'), history, withRedraft)); dispatch(deleteStatus(status.get('id'), withRedraft));
} else { } else {
dispatch(openModal({ dispatch(openModal({
modalType: 'CONFIRM', modalType: 'CONFIRM',
modalProps: { modalProps: {
message: intl.formatMessage(withRedraft ? messages.redraftMessage : messages.deleteMessage), message: intl.formatMessage(withRedraft ? messages.redraftMessage : messages.deleteMessage),
confirm: intl.formatMessage(withRedraft ? messages.redraftConfirm : messages.deleteConfirm), confirm: intl.formatMessage(withRedraft ? messages.redraftConfirm : messages.deleteConfirm),
onConfirm: () => dispatch(deleteStatus(status.get('id'), history, withRedraft)), onConfirm: () => dispatch(deleteStatus(status.get('id'), withRedraft)),
}, },
})); }));
} }
}, },
onEdit (status, history) { onEdit (status) {
dispatch((_, getState) => { dispatch((_, getState) => {
let state = getState(); let state = getState();
if (state.getIn(['compose', 'text']).trim().length !== 0) { if (state.getIn(['compose', 'text']).trim().length !== 0) {
@ -168,11 +168,11 @@ const mapDispatchToProps = (dispatch, { intl, contextType }) => ({
modalProps: { modalProps: {
message: intl.formatMessage(messages.editMessage), message: intl.formatMessage(messages.editMessage),
confirm: intl.formatMessage(messages.editConfirm), confirm: intl.formatMessage(messages.editConfirm),
onConfirm: () => dispatch(editStatus(status.get('id'), history)), onConfirm: () => dispatch(editStatus(status.get('id'))),
}, },
})); }));
} else { } else {
dispatch(editStatus(status.get('id'), history)); dispatch(editStatus(status.get('id')));
} }
}); });
}, },
@ -185,12 +185,12 @@ const mapDispatchToProps = (dispatch, { intl, contextType }) => ({
} }
}, },
onDirect (account, router) { onDirect (account) {
dispatch(directCompose(account, router)); dispatch(directCompose(account));
}, },
onMention (account, router) { onMention (account) {
dispatch(mentionCompose(account, router)); dispatch(mentionCompose(account));
}, },
onOpenMedia (statusId, media, index, lang) { onOpenMedia (statusId, media, index, lang) {

View file

@ -2,13 +2,11 @@ import PropTypes from 'prop-types';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import { NavLink, withRouter } from 'react-router-dom'; import { NavLink } from 'react-router-dom';
import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePropTypes from 'react-immutable-proptypes';
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';
import { WithRouterPropTypes } from 'mastodon/utils/react_router';
import InnerHeader from '../../account/components/header'; import InnerHeader from '../../account/components/header';
import MemorialNote from './memorial_note'; import MemorialNote from './memorial_note';
@ -36,7 +34,6 @@ class Header extends ImmutablePureComponent {
hideTabs: PropTypes.bool, hideTabs: PropTypes.bool,
domain: PropTypes.string.isRequired, domain: PropTypes.string.isRequired,
hidden: PropTypes.bool, hidden: PropTypes.bool,
...WithRouterPropTypes,
}; };
handleFollow = () => { handleFollow = () => {
@ -48,11 +45,11 @@ class Header extends ImmutablePureComponent {
}; };
handleMention = () => { handleMention = () => {
this.props.onMention(this.props.account, this.props.history); this.props.onMention(this.props.account);
}; };
handleDirect = () => { handleDirect = () => {
this.props.onDirect(this.props.account, this.props.history); this.props.onDirect(this.props.account);
}; };
handleReport = () => { handleReport = () => {
@ -155,4 +152,4 @@ class Header extends ImmutablePureComponent {
} }
export default withRouter(Header); export default Header;

View file

@ -77,12 +77,12 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
} }
}, },
onMention (account, router) { onMention (account) {
dispatch(mentionCompose(account, router)); dispatch(mentionCompose(account));
}, },
onDirect (account, router) { onDirect (account) {
dispatch(directCompose(account, router)); dispatch(directCompose(account));
}, },
onReblogToggle (account) { onReblogToggle (account) {

View file

@ -10,8 +10,6 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
import { length } from 'stringz'; import { length } from 'stringz';
import { WithOptionalRouterPropTypes, withOptionalRouter } from 'mastodon/utils/react_router';
import AutosuggestInput from '../../../components/autosuggest_input'; import AutosuggestInput from '../../../components/autosuggest_input';
import AutosuggestTextarea from '../../../components/autosuggest_textarea'; import AutosuggestTextarea from '../../../components/autosuggest_textarea';
import { Button } from '../../../components/button'; import { Button } from '../../../components/button';
@ -71,7 +69,6 @@ class ComposeForm extends ImmutablePureComponent {
singleColumn: PropTypes.bool, singleColumn: PropTypes.bool,
lang: PropTypes.string, lang: PropTypes.string,
maxChars: PropTypes.number, maxChars: PropTypes.number,
...WithOptionalRouterPropTypes
}; };
static defaultProps = { static defaultProps = {
@ -120,7 +117,7 @@ class ComposeForm extends ImmutablePureComponent {
return; return;
} }
this.props.onSubmit(this.props.history || null); this.props.onSubmit();
if (e) { if (e) {
e.preventDefault(); e.preventDefault();
@ -317,4 +314,4 @@ class ComposeForm extends ImmutablePureComponent {
} }
export default withOptionalRouter(injectIntl(ComposeForm)); export default injectIntl(ComposeForm);

View file

@ -37,8 +37,8 @@ const mapDispatchToProps = (dispatch) => ({
dispatch(changeCompose(text)); dispatch(changeCompose(text));
}, },
onSubmit (router) { onSubmit () {
dispatch(submitCompose(router)); dispatch(submitCompose());
}, },
onClearSuggestions () { onClearSuggestions () {

View file

@ -108,14 +108,14 @@ export const Conversation = ({ conversation, scrollKey, onMoveUp, onMoveDown })
modalProps: { modalProps: {
message: intl.formatMessage(messages.replyMessage), message: intl.formatMessage(messages.replyMessage),
confirm: intl.formatMessage(messages.replyConfirm), confirm: intl.formatMessage(messages.replyConfirm),
onConfirm: () => dispatch(replyCompose(lastStatus, history)), onConfirm: () => dispatch(replyCompose(lastStatus)),
}, },
})); }));
} else { } else {
dispatch(replyCompose(lastStatus, history)); dispatch(replyCompose(lastStatus));
} }
}); });
}, [dispatch, lastStatus, history, intl]); }, [dispatch, lastStatus, intl]);
const handleDelete = useCallback(() => { const handleDelete = useCallback(() => {
dispatch(deleteConversation(id)); dispatch(deleteConversation(id));

View file

@ -101,7 +101,7 @@ class Notification extends ImmutablePureComponent {
e.preventDefault(); e.preventDefault();
const { notification, onMention } = this.props; const { notification, onMention } = this.props;
onMention(notification.get('account'), this.props.history); onMention(notification.get('account'));
}; };
handleHotkeyFavourite = () => { handleHotkeyFavourite = () => {

View file

@ -34,8 +34,8 @@ const makeMapStateToProps = () => {
}; };
const mapDispatchToProps = dispatch => ({ const mapDispatchToProps = dispatch => ({
onMention: (account, router) => { onMention: (account) => {
dispatch(mentionCompose(account, router)); dispatch(mentionCompose(account));
}, },
onModalReblog (status, privacy) { onModalReblog (status, privacy) {

View file

@ -3,7 +3,7 @@ import { useCallback } from 'react';
import { FormattedMessage, useIntl, defineMessages } from 'react-intl'; import { FormattedMessage, useIntl, defineMessages } from 'react-intl';
import { Helmet } from 'react-helmet'; import { Helmet } from 'react-helmet';
import { Link, Switch, Route, useHistory } from 'react-router-dom'; import { Link, Switch, Route } from 'react-router-dom';
import { useDispatch } from 'react-redux'; import { useDispatch } from 'react-redux';
@ -35,11 +35,10 @@ const Onboarding = () => {
const account = useAppSelector(state => state.getIn(['accounts', me])); const account = useAppSelector(state => state.getIn(['accounts', me]));
const dispatch = useDispatch(); const dispatch = useDispatch();
const intl = useIntl(); const intl = useIntl();
const history = useHistory();
const handleComposeClick = useCallback(() => { const handleComposeClick = useCallback(() => {
dispatch(focusCompose(history, intl.formatMessage(messages.template))); dispatch(focusCompose(intl.formatMessage(messages.template)));
}, [dispatch, intl, history]); }, [dispatch, intl]);
return ( return (
<Column> <Column>

View file

@ -61,13 +61,13 @@ class Footer extends ImmutablePureComponent {
}; };
_performReply = () => { _performReply = () => {
const { dispatch, status, onClose, history } = this.props; const { dispatch, status, onClose } = this.props;
if (onClose) { if (onClose) {
onClose(true); onClose(true);
} }
dispatch(replyCompose(status, history)); dispatch(replyCompose(status));
}; };
handleReplyClick = () => { handleReplyClick = () => {

View file

@ -4,7 +4,6 @@ import { PureComponent } from 'react';
import { defineMessages, injectIntl } from 'react-intl'; import { defineMessages, injectIntl } from 'react-intl';
import classNames from 'classnames'; import classNames from 'classnames';
import { withRouter } from 'react-router-dom';
import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePropTypes from 'react-immutable-proptypes';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
@ -23,7 +22,6 @@ import RepeatPrivateIcon from '@/svg-icons/repeat_private.svg?react';
import RepeatPrivateActiveIcon from '@/svg-icons/repeat_private_active.svg?react'; import RepeatPrivateActiveIcon from '@/svg-icons/repeat_private_active.svg?react';
import { identityContextPropShape, withIdentity } from 'mastodon/identity_context'; import { identityContextPropShape, withIdentity } from 'mastodon/identity_context';
import { PERMISSION_MANAGE_USERS, PERMISSION_MANAGE_FEDERATION } from 'mastodon/permissions'; import { PERMISSION_MANAGE_USERS, PERMISSION_MANAGE_FEDERATION } from 'mastodon/permissions';
import { WithRouterPropTypes } from 'mastodon/utils/react_router';
import { IconButton } from '../../../components/icon_button'; import { IconButton } from '../../../components/icon_button';
import DropdownMenuContainer from '../../../containers/dropdown_menu_container'; import DropdownMenuContainer from '../../../containers/dropdown_menu_container';
@ -91,7 +89,6 @@ class ActionBar extends PureComponent {
onPin: PropTypes.func, onPin: PropTypes.func,
onEmbed: PropTypes.func, onEmbed: PropTypes.func,
intl: PropTypes.object.isRequired, intl: PropTypes.object.isRequired,
...WithRouterPropTypes,
}; };
handleReplyClick = () => { handleReplyClick = () => {
@ -111,23 +108,23 @@ class ActionBar extends PureComponent {
}; };
handleDeleteClick = () => { handleDeleteClick = () => {
this.props.onDelete(this.props.status, this.props.history); this.props.onDelete(this.props.status);
}; };
handleRedraftClick = () => { handleRedraftClick = () => {
this.props.onDelete(this.props.status, this.props.history, true); this.props.onDelete(this.props.status, true);
}; };
handleEditClick = () => { handleEditClick = () => {
this.props.onEdit(this.props.status, this.props.history); this.props.onEdit(this.props.status);
}; };
handleDirectClick = () => { handleDirectClick = () => {
this.props.onDirect(this.props.status.get('account'), this.props.history); this.props.onDirect(this.props.status.get('account'));
}; };
handleMentionClick = () => { handleMentionClick = () => {
this.props.onMention(this.props.status.get('account'), this.props.history); this.props.onMention(this.props.status.get('account'));
}; };
handleMuteClick = () => { handleMuteClick = () => {
@ -323,4 +320,4 @@ class ActionBar extends PureComponent {
} }
export default withRouter(connect(mapStateToProps)(withIdentity(injectIntl(ActionBar)))); export default connect(mapStateToProps)(withIdentity(injectIntl(ActionBar)));

View file

@ -55,7 +55,7 @@ const makeMapStateToProps = () => {
const mapDispatchToProps = (dispatch, { intl }) => ({ const mapDispatchToProps = (dispatch, { intl }) => ({
onReply (status, router) { onReply (status) {
dispatch((_, getState) => { dispatch((_, getState) => {
let state = getState(); let state = getState();
if (state.getIn(['compose', 'text']).trim().length !== 0) { if (state.getIn(['compose', 'text']).trim().length !== 0) {
@ -64,11 +64,11 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
modalProps: { modalProps: {
message: intl.formatMessage(messages.replyMessage), message: intl.formatMessage(messages.replyMessage),
confirm: intl.formatMessage(messages.replyConfirm), confirm: intl.formatMessage(messages.replyConfirm),
onConfirm: () => dispatch(replyCompose(status, router)), onConfirm: () => dispatch(replyCompose(status)),
}, },
})); }));
} else { } else {
dispatch(replyCompose(status, router)); dispatch(replyCompose(status));
} }
}); });
}, },
@ -115,27 +115,27 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
})); }));
}, },
onDelete (status, history, withRedraft = false) { onDelete (status, withRedraft = false) {
if (!deleteModal) { if (!deleteModal) {
dispatch(deleteStatus(status.get('id'), history, withRedraft)); dispatch(deleteStatus(status.get('id'), withRedraft));
} else { } else {
dispatch(openModal({ dispatch(openModal({
modalType: 'CONFIRM', modalType: 'CONFIRM',
modalProps: { modalProps: {
message: intl.formatMessage(withRedraft ? messages.redraftMessage : messages.deleteMessage), message: intl.formatMessage(withRedraft ? messages.redraftMessage : messages.deleteMessage),
confirm: intl.formatMessage(withRedraft ? messages.redraftConfirm : messages.deleteConfirm), confirm: intl.formatMessage(withRedraft ? messages.redraftConfirm : messages.deleteConfirm),
onConfirm: () => dispatch(deleteStatus(status.get('id'), history, withRedraft)), onConfirm: () => dispatch(deleteStatus(status.get('id'), withRedraft)),
}, },
})); }));
} }
}, },
onDirect (account, router) { onDirect (account) {
dispatch(directCompose(account, router)); dispatch(directCompose(account));
}, },
onMention (account, router) { onMention (account) {
dispatch(mentionCompose(account, router)); dispatch(mentionCompose(account));
}, },
onOpenMedia (media, index, lang) { onOpenMedia (media, index, lang) {

View file

@ -280,11 +280,11 @@ class Status extends ImmutablePureComponent {
modalProps: { modalProps: {
message: intl.formatMessage(messages.replyMessage), message: intl.formatMessage(messages.replyMessage),
confirm: intl.formatMessage(messages.replyConfirm), confirm: intl.formatMessage(messages.replyConfirm),
onConfirm: () => dispatch(replyCompose(status, this.props.history)), onConfirm: () => dispatch(replyCompose(status)),
}, },
})); }));
} else { } else {
dispatch(replyCompose(status, this.props.history)); dispatch(replyCompose(status));
} }
} else { } else {
dispatch(openModal({ dispatch(openModal({
@ -336,33 +336,33 @@ class Status extends ImmutablePureComponent {
} }
}; };
handleDeleteClick = (status, history, withRedraft = false) => { handleDeleteClick = (status, withRedraft = false) => {
const { dispatch, intl } = this.props; const { dispatch, intl } = this.props;
if (!deleteModal) { if (!deleteModal) {
dispatch(deleteStatus(status.get('id'), history, withRedraft)); dispatch(deleteStatus(status.get('id'), withRedraft));
} else { } else {
dispatch(openModal({ dispatch(openModal({
modalType: 'CONFIRM', modalType: 'CONFIRM',
modalProps: { modalProps: {
message: intl.formatMessage(withRedraft ? messages.redraftMessage : messages.deleteMessage), message: intl.formatMessage(withRedraft ? messages.redraftMessage : messages.deleteMessage),
confirm: intl.formatMessage(withRedraft ? messages.redraftConfirm : messages.deleteConfirm), confirm: intl.formatMessage(withRedraft ? messages.redraftConfirm : messages.deleteConfirm),
onConfirm: () => dispatch(deleteStatus(status.get('id'), history, withRedraft)), onConfirm: () => dispatch(deleteStatus(status.get('id'), withRedraft)),
}, },
})); }));
} }
}; };
handleEditClick = (status, history) => { handleEditClick = (status) => {
this.props.dispatch(editStatus(status.get('id'), history)); this.props.dispatch(editStatus(status.get('id')));
}; };
handleDirectClick = (account, router) => { handleDirectClick = (account) => {
this.props.dispatch(directCompose(account, router)); this.props.dispatch(directCompose(account));
}; };
handleMentionClick = (account, router) => { handleMentionClick = (account) => {
this.props.dispatch(mentionCompose(account, router)); this.props.dispatch(mentionCompose(account));
}; };
handleOpenMedia = (media, index, lang) => { handleOpenMedia = (media, index, lang) => {