Browse Source

Do not leave Mastodon when clicking “Back” (#23953)

closed-social-glitch-2
Christian Schmidt 1 year ago
committed by GitHub
parent
commit
cb868228bd
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 15 deletions
  1. +3
    -3
      app/javascript/mastodon/components/column_back_button.jsx
  2. +5
    -9
      app/javascript/mastodon/components/column_header.jsx
  3. +3
    -3
      app/javascript/mastodon/features/ui/index.jsx

+ 3
- 3
app/javascript/mastodon/components/column_back_button.jsx View File

@ -15,10 +15,10 @@ export default class ColumnBackButton extends React.PureComponent {
};
handleClick = () => {
if (window.history && window.history.length === 1) {
this.context.router.history.push('/');
} else {
if (window.history && window.history.state) {
this.context.router.history.goBack();
} else {
this.context.router.history.push('/');
}
};

+ 5
- 9
app/javascript/mastodon/components/column_header.jsx View File

@ -43,14 +43,6 @@ class ColumnHeader extends React.PureComponent {
animating: false,
};
historyBack = () => {
if (window.history && window.history.length === 1) {
this.context.router.history.push('/');
} else {
this.context.router.history.goBack();
}
};
handleToggleClick = (e) => {
e.stopPropagation();
this.setState({ collapsed: !this.state.collapsed, animating: true });
@ -69,7 +61,11 @@ class ColumnHeader extends React.PureComponent {
};
handleBackClick = () => {
this.historyBack();
if (window.history && window.history.state) {
this.context.router.history.goBack();
} else {
this.context.router.history.push('/');
}
};
handleTransitionEnd = () => {

+ 3
- 3
app/javascript/mastodon/features/ui/index.jsx View File

@ -474,10 +474,10 @@ class UI extends React.PureComponent {
};
handleHotkeyBack = () => {
if (window.history && window.history.length === 1) {
this.context.router.history.push('/');
} else {
if (window.history && window.history.state) {
this.context.router.history.goBack();
} else {
this.context.router.history.push('/');
}
};

Loading…
Cancel
Save