From e768b23aa995130c14a7160165eabcf1e8570dfd Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 19 Jul 2024 17:26:44 +0200 Subject: [PATCH] Remove routerHistory parameters from composer actions (#31077) --- app/javascript/mastodon/actions/compose.js | 29 ++++++++++--------- app/javascript/mastodon/actions/statuses.js | 8 ++--- app/javascript/mastodon/components/router.tsx | 2 +- app/javascript/mastodon/components/status.jsx | 4 +-- .../mastodon/components/status_action_bar.jsx | 12 ++++---- .../mastodon/containers/status_container.jsx | 26 ++++++++--------- .../account_timeline/components/header.jsx | 11 +++---- .../containers/header_container.jsx | 8 ++--- .../compose/components/compose_form.jsx | 7 ++--- .../containers/compose_form_container.js | 4 +-- .../components/conversation.jsx | 6 ++-- .../notifications/components/notification.jsx | 2 +- .../containers/notification_container.js | 4 +-- .../mastodon/features/onboarding/index.jsx | 7 ++--- .../picture_in_picture/components/footer.jsx | 4 +-- .../features/status/components/action_bar.jsx | 15 ++++------ .../containers/detailed_status_container.js | 20 ++++++------- .../mastodon/features/status/index.jsx | 22 +++++++------- 18 files changed, 91 insertions(+), 100 deletions(-) diff --git a/app/javascript/mastodon/actions/compose.js b/app/javascript/mastodon/actions/compose.js index 0bcba7d57f..4f2ed450dd 100644 --- a/app/javascript/mastodon/actions/compose.js +++ b/app/javascript/mastodon/actions/compose.js @@ -4,6 +4,7 @@ import axios from 'axios'; import { throttle } from 'lodash'; import api from 'mastodon/api'; +import { browserHistory } from 'mastodon/components/router'; import { search as emojiSearch } from 'mastodon/features/emoji/emoji_mart_search_light'; import { tagHistory } from 'mastodon/settings'; @@ -88,9 +89,9 @@ const messages = defineMessages({ saved: { id: 'compose.saved.body', defaultMessage: 'Post saved.' }, }); -export const ensureComposeIsVisible = (getState, routerHistory) => { +export const ensureComposeIsVisible = (getState) => { 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) => { dispatch({ type: COMPOSE_REPLY, 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({ type: COMPOSE_FOCUS, defaultText, }); - ensureComposeIsVisible(getState, routerHistory); + ensureComposeIsVisible(getState); }; -export function mentionCompose(account, routerHistory) { +export function mentionCompose(account) { return (dispatch, getState) => { dispatch({ type: COMPOSE_MENTION, account: account, }); - ensureComposeIsVisible(getState, routerHistory); + ensureComposeIsVisible(getState); }; } -export function directCompose(account, routerHistory) { +export function directCompose(account) { return (dispatch, getState) => { dispatch({ type: COMPOSE_DIRECT, account: account, }); - ensureComposeIsVisible(getState, routerHistory); + ensureComposeIsVisible(getState); }; } -export function submitCompose(routerHistory) { +export function submitCompose() { return function (dispatch, getState) { const status = getState().getIn(['compose', 'text'], ''); const media = getState().getIn(['compose', 'media_attachments']); @@ -214,8 +215,8 @@ export function submitCompose(routerHistory) { 'Idempotency-Key': getState().getIn(['compose', 'idempotencyKey']), }, }).then(function (response) { - if (routerHistory && (routerHistory.location.pathname === '/publish' || routerHistory.location.pathname === '/statuses/new') && window.history.state) { - routerHistory.goBack(); + if ((browserHistory.location.pathname === '/publish' || browserHistory.location.pathname === '/statuses/new') && window.history.state) { + browserHistory.goBack(); } dispatch(insertIntoTagHistory(response.data.tags, status)); @@ -249,7 +250,7 @@ export function submitCompose(routerHistory) { message: statusId === null ? messages.published : messages.saved, action: messages.open, 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) { dispatch(submitComposeFail(error)); diff --git a/app/javascript/mastodon/actions/statuses.js b/app/javascript/mastodon/actions/statuses.js index a60b80dc2c..1907d3aa91 100644 --- a/app/javascript/mastodon/actions/statuses.js +++ b/app/javascript/mastodon/actions/statuses.js @@ -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]); if (status.get('poll')) { @@ -104,7 +104,7 @@ export const editStatus = (id, routerHistory) => (dispatch, getState) => { api().get(`/api/v1/statuses/${id}/source`).then(response => { dispatch(fetchStatusSourceSuccess()); - ensureComposeIsVisible(getState, routerHistory); + ensureComposeIsVisible(getState); dispatch(setComposeToStatus(status, response.data.text, response.data.spoiler_text)); }).catch(error => { dispatch(fetchStatusSourceFail(error)); @@ -124,7 +124,7 @@ export const fetchStatusSourceFail = error => ({ error, }); -export function deleteStatus(id, routerHistory, withRedraft = false) { +export function deleteStatus(id, withRedraft = false) { return (dispatch, getState) => { let status = getState().getIn(['statuses', id]); @@ -141,7 +141,7 @@ export function deleteStatus(id, routerHistory, withRedraft = false) { if (withRedraft) { dispatch(redraft(status, response.data.text)); - ensureComposeIsVisible(getState, routerHistory); + ensureComposeIsVisible(getState); } }).catch(error => { dispatch(deleteStatusFail(id, error)); diff --git a/app/javascript/mastodon/components/router.tsx b/app/javascript/mastodon/components/router.tsx index 42b926659c..33fb60abb7 100644 --- a/app/javascript/mastodon/components/router.tsx +++ b/app/javascript/mastodon/components/router.tsx @@ -22,7 +22,7 @@ type LocationState = MastodonLocationState | null | undefined; type HistoryPath = Path | LocationDescriptor; -const browserHistory = createBrowserHistory(); +export const browserHistory = createBrowserHistory(); const originalPush = browserHistory.push.bind(browserHistory); const originalReplace = browserHistory.replace.bind(browserHistory); diff --git a/app/javascript/mastodon/components/status.jsx b/app/javascript/mastodon/components/status.jsx index 1723080e95..fe5f38889b 100644 --- a/app/javascript/mastodon/components/status.jsx +++ b/app/javascript/mastodon/components/status.jsx @@ -268,7 +268,7 @@ class Status extends ImmutablePureComponent { handleHotkeyReply = e => { e.preventDefault(); - this.props.onReply(this._properStatus(), this.props.history); + this.props.onReply(this._properStatus()); }; handleHotkeyFavourite = () => { @@ -281,7 +281,7 @@ class Status extends ImmutablePureComponent { handleHotkeyMention = e => { e.preventDefault(); - this.props.onMention(this._properStatus().get('account'), this.props.history); + this.props.onMention(this._properStatus().get('account')); }; handleHotkeyOpen = () => { diff --git a/app/javascript/mastodon/components/status_action_bar.jsx b/app/javascript/mastodon/components/status_action_bar.jsx index c79eae8460..2a7bd0a305 100644 --- a/app/javascript/mastodon/components/status_action_bar.jsx +++ b/app/javascript/mastodon/components/status_action_bar.jsx @@ -118,7 +118,7 @@ class StatusActionBar extends ImmutablePureComponent { const { signedIn } = this.props.identity; if (signedIn) { - this.props.onReply(this.props.status, this.props.history); + this.props.onReply(this.props.status); } else { this.props.onInteractionModal('reply', this.props.status); } @@ -157,15 +157,15 @@ class StatusActionBar extends ImmutablePureComponent { }; handleDeleteClick = () => { - this.props.onDelete(this.props.status, this.props.history); + this.props.onDelete(this.props.status); }; handleRedraftClick = () => { - this.props.onDelete(this.props.status, this.props.history, true); + this.props.onDelete(this.props.status, true); }; handleEditClick = () => { - this.props.onEdit(this.props.status, this.props.history); + this.props.onEdit(this.props.status); }; handlePinClick = () => { @@ -173,11 +173,11 @@ class StatusActionBar extends ImmutablePureComponent { }; handleMentionClick = () => { - this.props.onMention(this.props.status.get('account'), this.props.history); + this.props.onMention(this.props.status.get('account')); }; handleDirectClick = () => { - this.props.onDirect(this.props.status.get('account'), this.props.history); + this.props.onDirect(this.props.status.get('account')); }; handleMuteClick = () => { diff --git a/app/javascript/mastodon/containers/status_container.jsx b/app/javascript/mastodon/containers/status_container.jsx index 4a9b525777..e2c0af3533 100644 --- a/app/javascript/mastodon/containers/status_container.jsx +++ b/app/javascript/mastodon/containers/status_container.jsx @@ -76,7 +76,7 @@ const makeMapStateToProps = () => { const mapDispatchToProps = (dispatch, { intl, contextType }) => ({ - onReply (status, router) { + onReply (status) { dispatch((_, getState) => { let state = getState(); @@ -86,10 +86,10 @@ const mapDispatchToProps = (dispatch, { intl, contextType }) => ({ modalProps: { message: intl.formatMessage(messages.replyMessage), confirm: intl.formatMessage(messages.replyConfirm), - onConfirm: () => dispatch(replyCompose(status, router)) }, + onConfirm: () => dispatch(replyCompose(status)) }, })); } 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) { - dispatch(deleteStatus(status.get('id'), history, withRedraft)); + dispatch(deleteStatus(status.get('id'), withRedraft)); } else { dispatch(openModal({ modalType: 'CONFIRM', modalProps: { message: intl.formatMessage(withRedraft ? messages.redraftMessage : messages.deleteMessage), 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) => { let state = getState(); if (state.getIn(['compose', 'text']).trim().length !== 0) { @@ -168,11 +168,11 @@ const mapDispatchToProps = (dispatch, { intl, contextType }) => ({ modalProps: { message: intl.formatMessage(messages.editMessage), confirm: intl.formatMessage(messages.editConfirm), - onConfirm: () => dispatch(editStatus(status.get('id'), history)), + onConfirm: () => dispatch(editStatus(status.get('id'))), }, })); } else { - dispatch(editStatus(status.get('id'), history)); + dispatch(editStatus(status.get('id'))); } }); }, @@ -185,12 +185,12 @@ const mapDispatchToProps = (dispatch, { intl, contextType }) => ({ } }, - onDirect (account, router) { - dispatch(directCompose(account, router)); + onDirect (account) { + dispatch(directCompose(account)); }, - onMention (account, router) { - dispatch(mentionCompose(account, router)); + onMention (account) { + dispatch(mentionCompose(account)); }, onOpenMedia (statusId, media, index, lang) { diff --git a/app/javascript/mastodon/features/account_timeline/components/header.jsx b/app/javascript/mastodon/features/account_timeline/components/header.jsx index a2463b8764..403c423025 100644 --- a/app/javascript/mastodon/features/account_timeline/components/header.jsx +++ b/app/javascript/mastodon/features/account_timeline/components/header.jsx @@ -2,13 +2,11 @@ import PropTypes from 'prop-types'; 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 ImmutablePureComponent from 'react-immutable-pure-component'; -import { WithRouterPropTypes } from 'mastodon/utils/react_router'; - import InnerHeader from '../../account/components/header'; import MemorialNote from './memorial_note'; @@ -36,7 +34,6 @@ class Header extends ImmutablePureComponent { hideTabs: PropTypes.bool, domain: PropTypes.string.isRequired, hidden: PropTypes.bool, - ...WithRouterPropTypes, }; handleFollow = () => { @@ -48,11 +45,11 @@ class Header extends ImmutablePureComponent { }; handleMention = () => { - this.props.onMention(this.props.account, this.props.history); + this.props.onMention(this.props.account); }; handleDirect = () => { - this.props.onDirect(this.props.account, this.props.history); + this.props.onDirect(this.props.account); }; handleReport = () => { @@ -155,4 +152,4 @@ class Header extends ImmutablePureComponent { } -export default withRouter(Header); +export default Header; diff --git a/app/javascript/mastodon/features/account_timeline/containers/header_container.jsx b/app/javascript/mastodon/features/account_timeline/containers/header_container.jsx index d55d8c58e4..90298879d7 100644 --- a/app/javascript/mastodon/features/account_timeline/containers/header_container.jsx +++ b/app/javascript/mastodon/features/account_timeline/containers/header_container.jsx @@ -77,12 +77,12 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ } }, - onMention (account, router) { - dispatch(mentionCompose(account, router)); + onMention (account) { + dispatch(mentionCompose(account)); }, - onDirect (account, router) { - dispatch(directCompose(account, router)); + onDirect (account) { + dispatch(directCompose(account)); }, onReblogToggle (account) { diff --git a/app/javascript/mastodon/features/compose/components/compose_form.jsx b/app/javascript/mastodon/features/compose/components/compose_form.jsx index 9b4d3dfeb5..b5e8dabb7b 100644 --- a/app/javascript/mastodon/features/compose/components/compose_form.jsx +++ b/app/javascript/mastodon/features/compose/components/compose_form.jsx @@ -10,8 +10,6 @@ import ImmutablePureComponent from 'react-immutable-pure-component'; import { length } from 'stringz'; -import { WithOptionalRouterPropTypes, withOptionalRouter } from 'mastodon/utils/react_router'; - import AutosuggestInput from '../../../components/autosuggest_input'; import AutosuggestTextarea from '../../../components/autosuggest_textarea'; import { Button } from '../../../components/button'; @@ -71,7 +69,6 @@ class ComposeForm extends ImmutablePureComponent { singleColumn: PropTypes.bool, lang: PropTypes.string, maxChars: PropTypes.number, - ...WithOptionalRouterPropTypes }; static defaultProps = { @@ -120,7 +117,7 @@ class ComposeForm extends ImmutablePureComponent { return; } - this.props.onSubmit(this.props.history || null); + this.props.onSubmit(); if (e) { e.preventDefault(); @@ -317,4 +314,4 @@ class ComposeForm extends ImmutablePureComponent { } -export default withOptionalRouter(injectIntl(ComposeForm)); +export default injectIntl(ComposeForm); diff --git a/app/javascript/mastodon/features/compose/containers/compose_form_container.js b/app/javascript/mastodon/features/compose/containers/compose_form_container.js index b5e5300334..bda2edba60 100644 --- a/app/javascript/mastodon/features/compose/containers/compose_form_container.js +++ b/app/javascript/mastodon/features/compose/containers/compose_form_container.js @@ -37,8 +37,8 @@ const mapDispatchToProps = (dispatch) => ({ dispatch(changeCompose(text)); }, - onSubmit (router) { - dispatch(submitCompose(router)); + onSubmit () { + dispatch(submitCompose()); }, onClearSuggestions () { diff --git a/app/javascript/mastodon/features/direct_timeline/components/conversation.jsx b/app/javascript/mastodon/features/direct_timeline/components/conversation.jsx index a2b72f7162..63dc705e40 100644 --- a/app/javascript/mastodon/features/direct_timeline/components/conversation.jsx +++ b/app/javascript/mastodon/features/direct_timeline/components/conversation.jsx @@ -108,14 +108,14 @@ export const Conversation = ({ conversation, scrollKey, onMoveUp, onMoveDown }) modalProps: { message: intl.formatMessage(messages.replyMessage), confirm: intl.formatMessage(messages.replyConfirm), - onConfirm: () => dispatch(replyCompose(lastStatus, history)), + onConfirm: () => dispatch(replyCompose(lastStatus)), }, })); } else { - dispatch(replyCompose(lastStatus, history)); + dispatch(replyCompose(lastStatus)); } }); - }, [dispatch, lastStatus, history, intl]); + }, [dispatch, lastStatus, intl]); const handleDelete = useCallback(() => { dispatch(deleteConversation(id)); diff --git a/app/javascript/mastodon/features/notifications/components/notification.jsx b/app/javascript/mastodon/features/notifications/components/notification.jsx index 70a3252509..f1eada1359 100644 --- a/app/javascript/mastodon/features/notifications/components/notification.jsx +++ b/app/javascript/mastodon/features/notifications/components/notification.jsx @@ -101,7 +101,7 @@ class Notification extends ImmutablePureComponent { e.preventDefault(); const { notification, onMention } = this.props; - onMention(notification.get('account'), this.props.history); + onMention(notification.get('account')); }; handleHotkeyFavourite = () => { diff --git a/app/javascript/mastodon/features/notifications/containers/notification_container.js b/app/javascript/mastodon/features/notifications/containers/notification_container.js index 650acf4ccd..7b7e6e919c 100644 --- a/app/javascript/mastodon/features/notifications/containers/notification_container.js +++ b/app/javascript/mastodon/features/notifications/containers/notification_container.js @@ -34,8 +34,8 @@ const makeMapStateToProps = () => { }; const mapDispatchToProps = dispatch => ({ - onMention: (account, router) => { - dispatch(mentionCompose(account, router)); + onMention: (account) => { + dispatch(mentionCompose(account)); }, onModalReblog (status, privacy) { diff --git a/app/javascript/mastodon/features/onboarding/index.jsx b/app/javascript/mastodon/features/onboarding/index.jsx index 529d53f257..d100a1c3d5 100644 --- a/app/javascript/mastodon/features/onboarding/index.jsx +++ b/app/javascript/mastodon/features/onboarding/index.jsx @@ -3,7 +3,7 @@ import { useCallback } from 'react'; import { FormattedMessage, useIntl, defineMessages } from 'react-intl'; 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'; @@ -35,11 +35,10 @@ const Onboarding = () => { const account = useAppSelector(state => state.getIn(['accounts', me])); const dispatch = useDispatch(); const intl = useIntl(); - const history = useHistory(); const handleComposeClick = useCallback(() => { - dispatch(focusCompose(history, intl.formatMessage(messages.template))); - }, [dispatch, intl, history]); + dispatch(focusCompose(intl.formatMessage(messages.template))); + }, [dispatch, intl]); return ( diff --git a/app/javascript/mastodon/features/picture_in_picture/components/footer.jsx b/app/javascript/mastodon/features/picture_in_picture/components/footer.jsx index ba0642da28..8404bf61b7 100644 --- a/app/javascript/mastodon/features/picture_in_picture/components/footer.jsx +++ b/app/javascript/mastodon/features/picture_in_picture/components/footer.jsx @@ -61,13 +61,13 @@ class Footer extends ImmutablePureComponent { }; _performReply = () => { - const { dispatch, status, onClose, history } = this.props; + const { dispatch, status, onClose } = this.props; if (onClose) { onClose(true); } - dispatch(replyCompose(status, history)); + dispatch(replyCompose(status)); }; handleReplyClick = () => { diff --git a/app/javascript/mastodon/features/status/components/action_bar.jsx b/app/javascript/mastodon/features/status/components/action_bar.jsx index d610539987..d90ca464a7 100644 --- a/app/javascript/mastodon/features/status/components/action_bar.jsx +++ b/app/javascript/mastodon/features/status/components/action_bar.jsx @@ -4,7 +4,6 @@ import { PureComponent } from 'react'; import { defineMessages, injectIntl } from 'react-intl'; import classNames from 'classnames'; -import { withRouter } from 'react-router-dom'; import ImmutablePropTypes from 'react-immutable-proptypes'; 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 { identityContextPropShape, withIdentity } from 'mastodon/identity_context'; import { PERMISSION_MANAGE_USERS, PERMISSION_MANAGE_FEDERATION } from 'mastodon/permissions'; -import { WithRouterPropTypes } from 'mastodon/utils/react_router'; import { IconButton } from '../../../components/icon_button'; import DropdownMenuContainer from '../../../containers/dropdown_menu_container'; @@ -91,7 +89,6 @@ class ActionBar extends PureComponent { onPin: PropTypes.func, onEmbed: PropTypes.func, intl: PropTypes.object.isRequired, - ...WithRouterPropTypes, }; handleReplyClick = () => { @@ -111,23 +108,23 @@ class ActionBar extends PureComponent { }; handleDeleteClick = () => { - this.props.onDelete(this.props.status, this.props.history); + this.props.onDelete(this.props.status); }; handleRedraftClick = () => { - this.props.onDelete(this.props.status, this.props.history, true); + this.props.onDelete(this.props.status, true); }; handleEditClick = () => { - this.props.onEdit(this.props.status, this.props.history); + this.props.onEdit(this.props.status); }; handleDirectClick = () => { - this.props.onDirect(this.props.status.get('account'), this.props.history); + this.props.onDirect(this.props.status.get('account')); }; handleMentionClick = () => { - this.props.onMention(this.props.status.get('account'), this.props.history); + this.props.onMention(this.props.status.get('account')); }; handleMuteClick = () => { @@ -323,4 +320,4 @@ class ActionBar extends PureComponent { } -export default withRouter(connect(mapStateToProps)(withIdentity(injectIntl(ActionBar)))); +export default connect(mapStateToProps)(withIdentity(injectIntl(ActionBar))); diff --git a/app/javascript/mastodon/features/status/containers/detailed_status_container.js b/app/javascript/mastodon/features/status/containers/detailed_status_container.js index c3d4fec4db..f85c3822d7 100644 --- a/app/javascript/mastodon/features/status/containers/detailed_status_container.js +++ b/app/javascript/mastodon/features/status/containers/detailed_status_container.js @@ -55,7 +55,7 @@ const makeMapStateToProps = () => { const mapDispatchToProps = (dispatch, { intl }) => ({ - onReply (status, router) { + onReply (status) { dispatch((_, getState) => { let state = getState(); if (state.getIn(['compose', 'text']).trim().length !== 0) { @@ -64,11 +64,11 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ modalProps: { message: intl.formatMessage(messages.replyMessage), confirm: intl.formatMessage(messages.replyConfirm), - onConfirm: () => dispatch(replyCompose(status, router)), + onConfirm: () => dispatch(replyCompose(status)), }, })); } 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) { - dispatch(deleteStatus(status.get('id'), history, withRedraft)); + dispatch(deleteStatus(status.get('id'), withRedraft)); } else { dispatch(openModal({ modalType: 'CONFIRM', modalProps: { message: intl.formatMessage(withRedraft ? messages.redraftMessage : messages.deleteMessage), 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) { - dispatch(directCompose(account, router)); + onDirect (account) { + dispatch(directCompose(account)); }, - onMention (account, router) { - dispatch(mentionCompose(account, router)); + onMention (account) { + dispatch(mentionCompose(account)); }, onOpenMedia (media, index, lang) { diff --git a/app/javascript/mastodon/features/status/index.jsx b/app/javascript/mastodon/features/status/index.jsx index 7f37cb50d2..b0fbea9e22 100644 --- a/app/javascript/mastodon/features/status/index.jsx +++ b/app/javascript/mastodon/features/status/index.jsx @@ -280,11 +280,11 @@ class Status extends ImmutablePureComponent { modalProps: { message: intl.formatMessage(messages.replyMessage), confirm: intl.formatMessage(messages.replyConfirm), - onConfirm: () => dispatch(replyCompose(status, this.props.history)), + onConfirm: () => dispatch(replyCompose(status)), }, })); } else { - dispatch(replyCompose(status, this.props.history)); + dispatch(replyCompose(status)); } } else { dispatch(openModal({ @@ -336,33 +336,33 @@ class Status extends ImmutablePureComponent { } }; - handleDeleteClick = (status, history, withRedraft = false) => { + handleDeleteClick = (status, withRedraft = false) => { const { dispatch, intl } = this.props; if (!deleteModal) { - dispatch(deleteStatus(status.get('id'), history, withRedraft)); + dispatch(deleteStatus(status.get('id'), withRedraft)); } else { dispatch(openModal({ modalType: 'CONFIRM', modalProps: { message: intl.formatMessage(withRedraft ? messages.redraftMessage : messages.deleteMessage), 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) => { - this.props.dispatch(editStatus(status.get('id'), history)); + handleEditClick = (status) => { + this.props.dispatch(editStatus(status.get('id'))); }; - handleDirectClick = (account, router) => { - this.props.dispatch(directCompose(account, router)); + handleDirectClick = (account) => { + this.props.dispatch(directCompose(account)); }; - handleMentionClick = (account, router) => { - this.props.dispatch(mentionCompose(account, router)); + handleMentionClick = (account) => { + this.props.dispatch(mentionCompose(account)); }; handleOpenMedia = (media, index, lang) => {