diff --git a/app/javascript/flavours/glitch/actions/compose.js b/app/javascript/flavours/glitch/actions/compose.js index 8eab532f55..2041278a1c 100644 --- a/app/javascript/flavours/glitch/actions/compose.js +++ b/app/javascript/flavours/glitch/actions/compose.js @@ -4,6 +4,7 @@ import axios from 'axios'; import { throttle } from 'lodash'; import api from 'flavours/glitch/api'; +import { browserHistory } from 'flavours/glitch/components/router'; import { search as emojiSearch } from 'flavours/glitch/features/emoji/emoji_mart_search_light'; import { tagHistory } from 'flavours/glitch/settings'; import { recoverHashtags } from 'flavours/glitch/utils/hashtag'; @@ -94,9 +95,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'); } }; @@ -117,7 +118,7 @@ export function changeCompose(text) { }; } -export function replyCompose(status, routerHistory) { +export function replyCompose(status) { return (dispatch, getState) => { const prependCWRe = getState().getIn(['local_settings', 'prepend_cw_re']); dispatch({ @@ -126,7 +127,7 @@ export function replyCompose(status, routerHistory) { prependCWRe: prependCWRe, }); - ensureComposeIsVisible(getState, routerHistory); + ensureComposeIsVisible(getState); }; } @@ -142,38 +143,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, overridePrivacy = null) { +export function submitCompose(overridePrivacy = null) { return function (dispatch, getState) { let status = getState().getIn(['compose', 'text'], ''); const media = getState().getIn(['compose', 'media_attachments']); @@ -230,11 +231,10 @@ export function submitCompose(routerHistory, overridePrivacy = null) { 'Idempotency-Key': getState().getIn(['compose', 'idempotencyKey']), }, }).then(function (response) { - if (routerHistory - && (routerHistory.location.pathname === '/publish' || routerHistory.location.pathname === '/statuses/new') + if ((browserHistory.location.pathname === '/publish' || browserHistory.location.pathname === '/statuses/new') && window.history.state && !getState().getIn(['compose', 'advanced_options', 'threaded_mode'])) { - routerHistory.goBack(); + browserHistory.goBack(); } dispatch(insertIntoTagHistory(response.data.tags, status)); @@ -272,7 +272,7 @@ export function submitCompose(routerHistory, overridePrivacy = null) { 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) { diff --git a/app/javascript/flavours/glitch/actions/statuses.js b/app/javascript/flavours/glitch/actions/statuses.js index c4d292567d..054626bda0 100644 --- a/app/javascript/flavours/glitch/actions/statuses.js +++ b/app/javascript/flavours/glitch/actions/statuses.js @@ -94,7 +94,7 @@ export function redraft(status, raw_text, content_type) { }; } -export const editStatus = (id, routerHistory) => (dispatch, getState) => { +export const editStatus = (id) => (dispatch, getState) => { let status = getState().getIn(['statuses', id]); if (status.get('poll')) { @@ -105,7 +105,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, response.data.content_type)); }).catch(error => { dispatch(fetchStatusSourceFail(error)); @@ -125,7 +125,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]); @@ -142,7 +142,7 @@ export function deleteStatus(id, routerHistory, withRedraft = false) { if (withRedraft) { dispatch(redraft(status, response.data.text, response.data.content_type)); - ensureComposeIsVisible(getState, routerHistory); + ensureComposeIsVisible(getState); } }).catch(error => { dispatch(deleteStatusFail(id, error)); diff --git a/app/javascript/flavours/glitch/components/router.tsx b/app/javascript/flavours/glitch/components/router.tsx index 0637c35ada..48f35d8aed 100644 --- a/app/javascript/flavours/glitch/components/router.tsx +++ b/app/javascript/flavours/glitch/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/flavours/glitch/components/status.jsx b/app/javascript/flavours/glitch/components/status.jsx index c115251d65..e002e4df8c 100644 --- a/app/javascript/flavours/glitch/components/status.jsx +++ b/app/javascript/flavours/glitch/components/status.jsx @@ -442,7 +442,7 @@ class Status extends ImmutablePureComponent { handleHotkeyReply = e => { e.preventDefault(); - this.props.onReply(this.props.status, this.props.history); + this.props.onReply(this.props.status); }; handleHotkeyFavourite = (e) => { @@ -459,7 +459,7 @@ class Status extends ImmutablePureComponent { handleHotkeyMention = e => { e.preventDefault(); - this.props.onMention(this.props.status.get('account'), this.props.history); + this.props.onMention(this.props.status.get('account')); }; handleHotkeyOpen = () => { diff --git a/app/javascript/flavours/glitch/components/status_action_bar.jsx b/app/javascript/flavours/glitch/components/status_action_bar.jsx index 3dfe403987..7b00f84f1b 100644 --- a/app/javascript/flavours/glitch/components/status_action_bar.jsx +++ b/app/javascript/flavours/glitch/components/status_action_bar.jsx @@ -108,7 +108,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); } @@ -145,15 +145,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 = () => { @@ -161,11 +161,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/flavours/glitch/containers/status_container.js b/app/javascript/flavours/glitch/containers/status_container.js index 1430a0c845..a05ed5fe4f 100644 --- a/app/javascript/flavours/glitch/containers/status_container.js +++ b/app/javascript/flavours/glitch/containers/status_container.js @@ -93,7 +93,7 @@ const makeMapStateToProps = () => { const mapDispatchToProps = (dispatch, { intl, contextType }) => ({ - onReply (status, router) { + onReply (status) { dispatch((_, getState) => { let state = getState(); @@ -104,11 +104,11 @@ const mapDispatchToProps = (dispatch, { intl, contextType }) => ({ message: intl.formatMessage(messages.replyMessage), confirm: intl.formatMessage(messages.replyConfirm), onDoNotAsk: () => dispatch(changeLocalSetting(['confirm_before_clearing_draft'], false)), - onConfirm: () => dispatch(replyCompose(status, router)), + onConfirm: () => dispatch(replyCompose(status)), }, })); } else { - dispatch(replyCompose(status, router)); + dispatch(replyCompose(status)); } }); }, @@ -182,22 +182,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) { @@ -206,11 +206,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'))); } }); }, @@ -223,12 +223,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/flavours/glitch/features/account_timeline/components/header.jsx b/app/javascript/flavours/glitch/features/account_timeline/components/header.jsx index 37258d9d83..10a035a0fc 100644 --- a/app/javascript/flavours/glitch/features/account_timeline/components/header.jsx +++ b/app/javascript/flavours/glitch/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 'flavours/glitch/utils/react_router'; - import ActionBar from '../../account/components/action_bar'; import InnerHeader from '../../account/components/header'; @@ -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 = () => { @@ -158,4 +155,4 @@ class Header extends ImmutablePureComponent { } -export default withRouter(Header); +export default Header; diff --git a/app/javascript/flavours/glitch/features/account_timeline/containers/header_container.jsx b/app/javascript/flavours/glitch/features/account_timeline/containers/header_container.jsx index 1e85a08cd9..ba1241d829 100644 --- a/app/javascript/flavours/glitch/features/account_timeline/containers/header_container.jsx +++ b/app/javascript/flavours/glitch/features/account_timeline/containers/header_container.jsx @@ -75,12 +75,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/flavours/glitch/features/compose/components/compose_form.jsx b/app/javascript/flavours/glitch/features/compose/components/compose_form.jsx index 6f16abfc7f..ffed051c37 100644 --- a/app/javascript/flavours/glitch/features/compose/components/compose_form.jsx +++ b/app/javascript/flavours/glitch/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 'flavours/glitch/utils/react_router'; - import AutosuggestInput from '../../../components/autosuggest_input'; import AutosuggestTextarea from '../../../components/autosuggest_textarea'; import { Button } from '../../../components/button'; @@ -81,7 +79,6 @@ class ComposeForm extends ImmutablePureComponent { singleColumn: PropTypes.bool, lang: PropTypes.string, maxChars: PropTypes.number, - ...WithOptionalRouterPropTypes }; static defaultProps = { @@ -141,9 +138,9 @@ class ComposeForm extends ImmutablePureComponent { // Submit unless there are media with missing descriptions if (this.props.mediaDescriptionConfirmation && this.props.media && this.props.media.some(item => !item.get('description'))) { const firstWithoutDescription = this.props.media.find(item => !item.get('description')); - this.props.onMediaDescriptionConfirm(this.props.history || null, firstWithoutDescription.get('id'), overridePrivacy); + this.props.onMediaDescriptionConfirm(firstWithoutDescription.get('id'), overridePrivacy); } else { - this.props.onSubmit(this.props.history || null, overridePrivacy); + this.props.onSubmit(overridePrivacy); } }; @@ -351,4 +348,4 @@ class ComposeForm extends ImmutablePureComponent { } -export default withOptionalRouter(injectIntl(ComposeForm)); +export default injectIntl(ComposeForm); diff --git a/app/javascript/flavours/glitch/features/compose/containers/compose_form_container.js b/app/javascript/flavours/glitch/features/compose/containers/compose_form_container.js index 067621c84b..227e793869 100644 --- a/app/javascript/flavours/glitch/features/compose/containers/compose_form_container.js +++ b/app/javascript/flavours/glitch/features/compose/containers/compose_form_container.js @@ -82,8 +82,8 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ dispatch(changeCompose(text)); }, - onSubmit (router, overridePrivacy = null) { - dispatch(submitCompose(router, overridePrivacy)); + onSubmit (overridePrivacy = null) { + dispatch(submitCompose(overridePrivacy)); }, onClearSuggestions () { @@ -110,14 +110,14 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ dispatch(insertEmojiCompose(position, data, needsSpace)); }, - onMediaDescriptionConfirm (routerHistory, mediaId, overridePrivacy = null) { + onMediaDescriptionConfirm (mediaId, overridePrivacy = null) { dispatch(openModal({ modalType: 'CONFIRM', modalProps: { message: intl.formatMessage(messages.missingDescriptionMessage), confirm: intl.formatMessage(messages.missingDescriptionConfirm), onConfirm: () => { - dispatch(submitCompose(routerHistory, overridePrivacy)); + dispatch(submitCompose(overridePrivacy)); }, secondary: intl.formatMessage(messages.missingDescriptionEdit), onSecondary: () => dispatch(openModal({ diff --git a/app/javascript/flavours/glitch/features/direct_timeline/components/conversation.jsx b/app/javascript/flavours/glitch/features/direct_timeline/components/conversation.jsx index 7071c8719d..839de34dd4 100644 --- a/app/javascript/flavours/glitch/features/direct_timeline/components/conversation.jsx +++ b/app/javascript/flavours/glitch/features/direct_timeline/components/conversation.jsx @@ -126,14 +126,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/flavours/glitch/features/notifications/components/notification.jsx b/app/javascript/flavours/glitch/features/notifications/components/notification.jsx index 0751258be9..1a049847d5 100644 --- a/app/javascript/flavours/glitch/features/notifications/components/notification.jsx +++ b/app/javascript/flavours/glitch/features/notifications/components/notification.jsx @@ -92,7 +92,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/flavours/glitch/features/notifications/containers/notification_container.js b/app/javascript/flavours/glitch/features/notifications/containers/notification_container.js index 338d27d8d6..b4df05b828 100644 --- a/app/javascript/flavours/glitch/features/notifications/containers/notification_container.js +++ b/app/javascript/flavours/glitch/features/notifications/containers/notification_container.js @@ -31,8 +31,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/flavours/glitch/features/onboarding/index.jsx b/app/javascript/flavours/glitch/features/onboarding/index.jsx index 187ee3b770..7922b61677 100644 --- a/app/javascript/flavours/glitch/features/onboarding/index.jsx +++ b/app/javascript/flavours/glitch/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'; @@ -34,11 +34,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/flavours/glitch/features/picture_in_picture/components/footer.jsx b/app/javascript/flavours/glitch/features/picture_in_picture/components/footer.jsx index 13ad86f801..2b27070007 100644 --- a/app/javascript/flavours/glitch/features/picture_in_picture/components/footer.jsx +++ b/app/javascript/flavours/glitch/features/picture_in_picture/components/footer.jsx @@ -63,13 +63,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/flavours/glitch/features/status/components/action_bar.jsx b/app/javascript/flavours/glitch/features/status/components/action_bar.jsx index 808712b021..3377019bdc 100644 --- a/app/javascript/flavours/glitch/features/status/components/action_bar.jsx +++ b/app/javascript/flavours/glitch/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'; @@ -23,7 +22,6 @@ import RepeatPrivateActiveIcon from '@/svg-icons/repeat_private_active.svg?react import { identityContextPropShape, withIdentity } from 'flavours/glitch/identity_context'; import { PERMISSION_MANAGE_USERS, PERMISSION_MANAGE_FEDERATION } from 'flavours/glitch/permissions'; import { accountAdminLink, statusAdminLink } from 'flavours/glitch/utils/backend_links'; -import { WithRouterPropTypes } from 'flavours/glitch/utils/react_router'; import { IconButton } from '../../../components/icon_button'; import DropdownMenuContainer from '../../../containers/dropdown_menu_container'; @@ -78,7 +76,6 @@ class ActionBar extends PureComponent { onPin: PropTypes.func, onEmbed: PropTypes.func, intl: PropTypes.object.isRequired, - ...WithRouterPropTypes, }; handleReplyClick = () => { @@ -98,23 +95,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 = () => { @@ -262,4 +259,4 @@ class ActionBar extends PureComponent { } -export default withRouter(withIdentity(injectIntl(ActionBar))); +export default withIdentity(injectIntl(ActionBar)); diff --git a/app/javascript/flavours/glitch/features/status/containers/detailed_status_container.js b/app/javascript/flavours/glitch/features/status/containers/detailed_status_container.js index 7cb9735cfe..9663f7ca4e 100644 --- a/app/javascript/flavours/glitch/features/status/containers/detailed_status_container.js +++ b/app/javascript/flavours/glitch/features/status/containers/detailed_status_container.js @@ -52,7 +52,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) { @@ -61,11 +61,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)); } }); }, @@ -112,27 +112,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/flavours/glitch/features/status/index.jsx b/app/javascript/flavours/glitch/features/status/index.jsx index 00639a667e..eb965046d1 100644 --- a/app/javascript/flavours/glitch/features/status/index.jsx +++ b/app/javascript/flavours/glitch/features/status/index.jsx @@ -324,11 +324,11 @@ class Status extends ImmutablePureComponent { message: intl.formatMessage(messages.replyMessage), confirm: intl.formatMessage(messages.replyConfirm), onDoNotAsk: () => dispatch(changeLocalSetting(['confirm_before_clearing_draft'], false)), - onConfirm: () => dispatch(replyCompose(status, this.props.history)), + onConfirm: () => dispatch(replyCompose(status)), }, })); } else { - dispatch(replyCompose(status, this.props.history)); + dispatch(replyCompose(status)); } } else { dispatch(openModal({ @@ -384,33 +384,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, history) => { - this.props.dispatch(directCompose(account, history)); + handleDirectClick = (account) => { + this.props.dispatch(directCompose(account)); }; - handleMentionClick = (account, history) => { - this.props.dispatch(mentionCompose(account, history)); + handleMentionClick = (account) => { + this.props.dispatch(mentionCompose(account)); }; handleOpenMedia = (media, index, lang) => {