mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-15 08:48:53 +00:00
[Glitch] Upgrade to react-router v5
Port 1b70d7ed7c to glitch-soc
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
@@ -1,25 +1,24 @@
|
||||
// Package imports.
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
|
||||
import classNames from 'classnames';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||
|
||||
import { HotKeys } from 'react-hotkeys';
|
||||
|
||||
|
||||
// Our imports.
|
||||
import { Icon } from 'flavours/glitch/components/icon';
|
||||
import Permalink from 'flavours/glitch/components/permalink';
|
||||
import { WithRouterPropTypes } from 'flavours/glitch/utils/react_router';
|
||||
|
||||
import NotificationOverlayContainer from '../containers/overlay_container';
|
||||
|
||||
import Report from './report';
|
||||
|
||||
export default class AdminReport extends ImmutablePureComponent {
|
||||
class AdminReport extends ImmutablePureComponent {
|
||||
|
||||
static propTypes = {
|
||||
hidden: PropTypes.bool,
|
||||
@@ -28,6 +27,7 @@ export default class AdminReport extends ImmutablePureComponent {
|
||||
notification: ImmutablePropTypes.map.isRequired,
|
||||
unread: PropTypes.bool,
|
||||
report: ImmutablePropTypes.map.isRequired,
|
||||
...WithRouterPropTypes,
|
||||
};
|
||||
|
||||
handleMoveUp = () => {
|
||||
@@ -45,15 +45,15 @@ export default class AdminReport extends ImmutablePureComponent {
|
||||
};
|
||||
|
||||
handleOpenProfile = () => {
|
||||
const { notification } = this.props;
|
||||
this.context.router.history.push(`/@${notification.getIn(['account', 'acct'])}`);
|
||||
const { history, notification } = this.props;
|
||||
history.push(`/@${notification.getIn(['account', 'acct'])}`);
|
||||
};
|
||||
|
||||
handleMention = e => {
|
||||
e.preventDefault();
|
||||
|
||||
const { notification, onMention } = this.props;
|
||||
onMention(notification.get('account'), this.context.router.history);
|
||||
const { history, notification, onMention } = this.props;
|
||||
onMention(notification.get('account'), history);
|
||||
};
|
||||
|
||||
getHandlers () {
|
||||
@@ -111,3 +111,5 @@ export default class AdminReport extends ImmutablePureComponent {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default withRouter(AdminReport);
|
||||
|
||||
@@ -1,24 +1,23 @@
|
||||
// Package imports.
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
|
||||
import classNames from 'classnames';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||
|
||||
import { HotKeys } from 'react-hotkeys';
|
||||
|
||||
|
||||
// Our imports.
|
||||
import { Icon } from 'flavours/glitch/components/icon';
|
||||
import Permalink from 'flavours/glitch/components/permalink';
|
||||
import AccountContainer from 'flavours/glitch/containers/account_container';
|
||||
import { WithRouterPropTypes } from 'flavours/glitch/utils/react_router';
|
||||
|
||||
import NotificationOverlayContainer from '../containers/overlay_container';
|
||||
|
||||
export default class NotificationFollow extends ImmutablePureComponent {
|
||||
class NotificationAdminSignup extends ImmutablePureComponent {
|
||||
|
||||
static propTypes = {
|
||||
hidden: PropTypes.bool,
|
||||
@@ -26,6 +25,7 @@ export default class NotificationFollow extends ImmutablePureComponent {
|
||||
account: ImmutablePropTypes.map.isRequired,
|
||||
notification: ImmutablePropTypes.map.isRequired,
|
||||
unread: PropTypes.bool,
|
||||
...WithRouterPropTypes,
|
||||
};
|
||||
|
||||
handleMoveUp = () => {
|
||||
@@ -43,15 +43,15 @@ export default class NotificationFollow extends ImmutablePureComponent {
|
||||
};
|
||||
|
||||
handleOpenProfile = () => {
|
||||
const { notification } = this.props;
|
||||
this.context.router.history.push(`/@${notification.getIn(['account', 'acct'])}`);
|
||||
const { history, notification } = this.props;
|
||||
history.push(`/@${notification.getIn(['account', 'acct'])}`);
|
||||
};
|
||||
|
||||
handleMention = e => {
|
||||
e.preventDefault();
|
||||
|
||||
const { notification, onMention } = this.props;
|
||||
onMention(notification.get('account'), this.context.router.history);
|
||||
const { history, notification, onMention } = this.props;
|
||||
onMention(notification.get('account'), history);
|
||||
};
|
||||
|
||||
getHandlers () {
|
||||
@@ -104,3 +104,5 @@ export default class NotificationFollow extends ImmutablePureComponent {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default withRouter(NotificationAdminSignup);
|
||||
|
||||
@@ -1,24 +1,23 @@
|
||||
// Package imports.
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
|
||||
import classNames from 'classnames';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||
|
||||
import { HotKeys } from 'react-hotkeys';
|
||||
|
||||
|
||||
// Our imports.
|
||||
import { Icon } from 'flavours/glitch/components/icon';
|
||||
import Permalink from 'flavours/glitch/components/permalink';
|
||||
import AccountContainer from 'flavours/glitch/containers/account_container';
|
||||
import { WithRouterPropTypes } from 'flavours/glitch/utils/react_router';
|
||||
|
||||
import NotificationOverlayContainer from '../containers/overlay_container';
|
||||
|
||||
export default class NotificationFollow extends ImmutablePureComponent {
|
||||
class NotificationFollow extends ImmutablePureComponent {
|
||||
|
||||
static propTypes = {
|
||||
hidden: PropTypes.bool,
|
||||
@@ -26,6 +25,7 @@ export default class NotificationFollow extends ImmutablePureComponent {
|
||||
account: ImmutablePropTypes.map.isRequired,
|
||||
notification: ImmutablePropTypes.map.isRequired,
|
||||
unread: PropTypes.bool,
|
||||
...WithRouterPropTypes,
|
||||
};
|
||||
|
||||
handleMoveUp = () => {
|
||||
@@ -43,15 +43,15 @@ export default class NotificationFollow extends ImmutablePureComponent {
|
||||
};
|
||||
|
||||
handleOpenProfile = () => {
|
||||
const { notification } = this.props;
|
||||
this.context.router.history.push(`/@${notification.getIn(['account', 'acct'])}`);
|
||||
const { history, notification } = this.props;
|
||||
history.push(`/@${notification.getIn(['account', 'acct'])}`);
|
||||
};
|
||||
|
||||
handleMention = e => {
|
||||
e.preventDefault();
|
||||
|
||||
const { notification, onMention } = this.props;
|
||||
onMention(notification.get('account'), this.context.router.history);
|
||||
const { history, notification, onMention } = this.props;
|
||||
onMention(notification.get('account'), history);
|
||||
};
|
||||
|
||||
getHandlers () {
|
||||
@@ -104,3 +104,5 @@ export default class NotificationFollow extends ImmutablePureComponent {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default withRouter(NotificationFollow);
|
||||
|
||||
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
|
||||
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
|
||||
|
||||
import classNames from 'classnames';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||
@@ -14,6 +15,7 @@ import { DisplayName } from 'flavours/glitch/components/display_name';
|
||||
import { Icon } from 'flavours/glitch/components/icon';
|
||||
import { IconButton } from 'flavours/glitch/components/icon_button';
|
||||
import Permalink from 'flavours/glitch/components/permalink';
|
||||
import { WithRouterPropTypes } from 'flavours/glitch/utils/react_router';
|
||||
|
||||
import NotificationOverlayContainer from '../containers/overlay_container';
|
||||
|
||||
@@ -31,6 +33,7 @@ class FollowRequest extends ImmutablePureComponent {
|
||||
intl: PropTypes.object.isRequired,
|
||||
notification: ImmutablePropTypes.map.isRequired,
|
||||
unread: PropTypes.bool,
|
||||
...WithRouterPropTypes,
|
||||
};
|
||||
|
||||
handleMoveUp = () => {
|
||||
@@ -48,15 +51,15 @@ class FollowRequest extends ImmutablePureComponent {
|
||||
};
|
||||
|
||||
handleOpenProfile = () => {
|
||||
const { notification } = this.props;
|
||||
this.context.router.history.push(`/@${notification.getIn(['account', 'acct'])}`);
|
||||
const { history, notification } = this.props;
|
||||
history.push(`/@${notification.getIn(['account', 'acct'])}`);
|
||||
};
|
||||
|
||||
handleMention = e => {
|
||||
e.preventDefault();
|
||||
|
||||
const { notification, onMention } = this.props;
|
||||
onMention(notification.get('account'), this.context.router.history);
|
||||
const { history, notification, onMention } = this.props;
|
||||
onMention(notification.get('account'), history);
|
||||
};
|
||||
|
||||
getHandlers () {
|
||||
@@ -135,4 +138,4 @@ class FollowRequest extends ImmutablePureComponent {
|
||||
|
||||
}
|
||||
|
||||
export default injectIntl(FollowRequest);
|
||||
export default withRouter(injectIntl(FollowRequest));
|
||||
|
||||
Reference in New Issue
Block a user