Greatly simplify history management code (#2230)
Fixes #2220 This drops the ability to shift+click on “Back” to get back to a pinned column, but that was inconsistent, broken, and undocumented. This also brings us slightly closer to upstream.
This commit is contained in:
@@ -21,9 +21,7 @@ export default class MovedNote extends ImmutablePureComponent {
|
||||
handleAccountClick = e => {
|
||||
if (e.button === 0) {
|
||||
e.preventDefault();
|
||||
let state = { ...this.context.router.history.location.state };
|
||||
state.mastodonBackSteps = (state.mastodonBackSteps || 0) + 1;
|
||||
this.context.router.history.push(`/@${this.props.to.get('acct')}`, state);
|
||||
this.context.router.history.push(`/@${this.props.to.get('acct')}`);
|
||||
}
|
||||
|
||||
e.stopPropagation();
|
||||
|
||||
@@ -59,9 +59,7 @@ class Conversation extends ImmutablePureComponent {
|
||||
}
|
||||
destination = `/statuses/${lastStatus.get('id')}`;
|
||||
}
|
||||
let state = { ...router.history.location.state };
|
||||
state.mastodonBackSteps = (state.mastodonBackSteps || 0) + 1;
|
||||
router.history.push(destination, state);
|
||||
router.history.push(destination);
|
||||
e.preventDefault();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -55,9 +55,7 @@ class DetailedStatus extends ImmutablePureComponent {
|
||||
handleAccountClick = (e) => {
|
||||
if (e.button === 0 && !(e.ctrlKey || e.altKey || e.metaKey) && this.context.router) {
|
||||
e.preventDefault();
|
||||
let state = { ...this.context.router.history.location.state };
|
||||
state.mastodonBackSteps = (state.mastodonBackSteps || 0) + 1;
|
||||
this.context.router.history.push(`/@${this.props.status.getIn(['account', 'acct'])}`, state);
|
||||
this.context.router.history.push(`/@${this.props.status.getIn(['account', 'acct'])}`);
|
||||
}
|
||||
|
||||
e.stopPropagation();
|
||||
@@ -66,9 +64,7 @@ class DetailedStatus extends ImmutablePureComponent {
|
||||
parseClick = (e, destination) => {
|
||||
if (e.button === 0 && !(e.ctrlKey || e.altKey || e.metaKey) && this.context.router) {
|
||||
e.preventDefault();
|
||||
let state = { ...this.context.router.history.location.state };
|
||||
state.mastodonBackSteps = (state.mastodonBackSteps || 0) + 1;
|
||||
this.context.router.history.push(destination, state);
|
||||
this.context.router.history.push(destination);
|
||||
}
|
||||
|
||||
e.stopPropagation();
|
||||
|
||||
@@ -502,9 +502,7 @@ class Status extends ImmutablePureComponent {
|
||||
};
|
||||
|
||||
handleHotkeyOpenProfile = () => {
|
||||
let state = { ...this.context.router.history.location.state };
|
||||
state.mastodonBackSteps = (state.mastodonBackSteps || 0) + 1;
|
||||
this.context.router.history.push(`/@${this.props.status.getIn(['account', 'acct'])}`, state);
|
||||
this.context.router.history.push(`/@${this.props.status.getIn(['account', 'acct'])}`);
|
||||
};
|
||||
|
||||
handleMoveUp = id => {
|
||||
|
||||
@@ -62,9 +62,7 @@ class BoostModal extends ImmutablePureComponent {
|
||||
if (e.button === 0) {
|
||||
e.preventDefault();
|
||||
this.props.onClose();
|
||||
let state = { ...this.context.router.history.location.state };
|
||||
state.mastodonBackSteps = (state.mastodonBackSteps || 0) + 1;
|
||||
this.context.router.history.push(`/@${this.props.status.getIn(['account', 'acct'])}`, state);
|
||||
this.context.router.history.push(`/@${this.props.status.getIn(['account', 'acct'])}`);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -43,9 +43,7 @@ class FavouriteModal extends ImmutablePureComponent {
|
||||
if (e.button === 0) {
|
||||
e.preventDefault();
|
||||
this.props.onClose();
|
||||
let state = { ...this.context.router.history.location.state };
|
||||
state.mastodonBackSteps = (state.mastodonBackSteps || 0) + 1;
|
||||
this.context.router.history.push(`/@${this.props.status.getIn(['account', 'acct'])}`, state);
|
||||
this.context.router.history.push(`/@${this.props.status.getIn(['account', 'acct'])}`);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user