about summary refs log tree commit diff
path: root/app/javascript/mastodon/components/column_header.jsx
diff options
context:
space:
mode:
authorChristian Schmidt <github@chsc.dk>2023-03-04 23:18:19 +0100
committerGitHub <noreply@github.com>2023-03-04 23:18:19 +0100
commitcb868228bde5351b79041f341a151bb08118d31f (patch)
tree08fb1d0cd8b7a700278e28f107ef5f7e332a7f81 /app/javascript/mastodon/components/column_header.jsx
parentc599e289d806f6d13e3383879750db053a654821 (diff)
Do not leave Mastodon when clicking “Back” (#23953)
Diffstat (limited to 'app/javascript/mastodon/components/column_header.jsx')
-rw-r--r--app/javascript/mastodon/components/column_header.jsx14
1 files changed, 5 insertions, 9 deletions
diff --git a/app/javascript/mastodon/components/column_header.jsx b/app/javascript/mastodon/components/column_header.jsx
index 38f6ad60f..9ba783d90 100644
--- a/app/javascript/mastodon/components/column_header.jsx
+++ b/app/javascript/mastodon/components/column_header.jsx
@@ -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 = () => {