@ -42,20 +42,6 @@ class ColumnHeader extends React.PureComponent {
animating : false ,
} ;
historyBack = ( skip ) => {
/ / i f h i s t o r y i s e x h a u s t e d , o r w e w o u l d l e a v e m a s t o d o n , j u s t g o t o r o o t .
if ( window . history . state ) {
const state = this . context . router . history . location . state ;
if ( skip && state && state . mastodonBackSteps ) {
this . context . router . history . go ( - state . mastodonBackSteps ) ;
} else {
this . context . router . history . goBack ( ) ;
}
} else {
this . context . router . history . push ( '/' ) ;
}
} ;
handleToggleClick = ( e ) => {
e . stopPropagation ( ) ;
this . setState ( { collapsed : ! this . state . collapsed , animating : true } ) ;
@ -73,8 +59,16 @@ class ColumnHeader extends React.PureComponent {
this . props . onMove ( 1 ) ;
} ;
handleBackClick = ( event ) => {
this . historyBack ( event . shiftKey ) ;
handleBackClick = ( ) => {
const { router } = this . context ;
/ / C h e c k i f t h e r e i s a p r e v i o u s p a g e i n t h e a p p t o g o b a c k t o p e r h t t p s : / / s t a c k o v e r f l o w . c o m / a / 7 0 5 3 2 8 5 8 / 9 7 0 3 2 0 1
/ / W h e n u p g r a d i n g t o V 6 , c h e c k ` l o c a t i o n . k e y ! = = ' d e f a u l t ' ` i n s t e a d p e r h t t p s : / / g i t h u b . c o m / r e m i x - r u n / h i s t o r y / b l o b / m a i n / d o c s / a p i - r e f e r e n c e . m d # l o c a t i o n
if ( router . route . location . key ) {
router . history . goBack ( ) ;
} else {
router . history . push ( '/' ) ;
}
} ;
handleTransitionEnd = ( ) => {
@ -83,8 +77,9 @@ class ColumnHeader extends React.PureComponent {
handlePin = ( ) => {
if ( ! this . props . pinned ) {
this . historyBack ( ) ;
this . context . router . history . replace ( '/' ) ;
}
this . props . onPin ( ) ;
} ;