]> cat aescling's git repositories - mastodon.git/commitdiff
Making the back button a little smarter
authorKibigo <marrus-sh@users.noreply.github.com>
Wed, 1 Mar 2017 06:24:34 +0000 (22:24 -0800)
committerKibigo <marrus-sh@users.noreply.github.com>
Wed, 1 Mar 2017 06:24:34 +0000 (22:24 -0800)
app/assets/javascripts/components/components/column_back_button.jsx

index 6abf11239b595b6b4fb060f9e7ed082d1c00d3f2..6b5ffee53f7ed40af7e8d48f32dc4599b04a1426 100644 (file)
@@ -15,7 +15,8 @@ const ColumnBackButton = React.createClass({
   mixins: [PureRenderMixin],
 
   handleClick () {
-    this.context.router.goBack();
+    if (window.history && window.history.length == 1) this.context.router.push("/");
+    else this.context.router.goBack();
   },
 
   render () {