@ -51,10 +51,12 @@ import {
Lists ,
Lists ,
Search ,
Search ,
Directory ,
Directory ,
FollowRecommendations ,
} from './util/async-components' ;
} from './util/async-components' ;
import { me } from '../../initial_state' ;
import { me } from '../../initial_state' ;
import { previewState as previewMediaState } from './components/media_modal' ;
import { previewState as previewMediaState } from './components/media_modal' ;
import { previewState as previewVideoState } from './components/video_modal' ;
import { previewState as previewVideoState } from './components/video_modal' ;
import { closeOnboarding , INTRODUCTION_VERSION } from 'mastodon/actions/onboarding' ;
// Dummy import, to make sure that <Status /> ends up in the application bundle.
// Dummy import, to make sure that <Status /> ends up in the application bundle.
// Without this it ends up in ~8 very commonly used bundles.
// Without this it ends up in ~8 very commonly used bundles.
@ -71,6 +73,7 @@ const mapStateToProps = state => ({
hasMediaAttachments : state . getIn ( [ 'compose' , 'media_attachments' ] ) . size > 0 ,
hasMediaAttachments : state . getIn ( [ 'compose' , 'media_attachments' ] ) . size > 0 ,
canUploadMore : ! state . getIn ( [ 'compose' , 'media_attachments' ] ) . some ( x => [ 'audio' , 'video' ] . includes ( x . get ( 'type' ) ) ) && state . getIn ( [ 'compose' , 'media_attachments' ] ) . size < 4 ,
canUploadMore : ! state . getIn ( [ 'compose' , 'media_attachments' ] ) . some ( x => [ 'audio' , 'video' ] . includes ( x . get ( 'type' ) ) ) && state . getIn ( [ 'compose' , 'media_attachments' ] ) . size < 4 ,
dropdownMenuIsOpen : state . getIn ( [ 'dropdown_menu' , 'openId' ] ) !== null ,
dropdownMenuIsOpen : state . getIn ( [ 'dropdown_menu' , 'openId' ] ) !== null ,
firstLaunch : state . getIn ( [ 'settings' , 'introductionVersion' ] , 0 ) < INTRODUCTION_VERSION ,
} ) ;
} ) ;
const keyMap = {
const keyMap = {
@ -167,6 +170,7 @@ class SwitchingColumnsArea extends React.PureComponent {
< WrappedRoute path = '/bookmarks' component = { BookmarkedStatuses } content = { children } / >
< WrappedRoute path = '/bookmarks' component = { BookmarkedStatuses } content = { children } / >
< WrappedRoute path = '/pinned' component = { PinnedStatuses } content = { children } componentParams = { { shouldUpdateScroll : this . shouldUpdateScroll } } / >
< WrappedRoute path = '/pinned' component = { PinnedStatuses } content = { children } componentParams = { { shouldUpdateScroll : this . shouldUpdateScroll } } / >
< WrappedRoute path = '/start' component = { FollowRecommendations } content = { children } / >
< WrappedRoute path = '/search' component = { Search } content = { children } / >
< WrappedRoute path = '/search' component = { Search } content = { children } / >
< WrappedRoute path = '/directory' component = { Directory } content = { children } componentParams = { { shouldUpdateScroll : this . shouldUpdateScroll } } / >
< WrappedRoute path = '/directory' component = { Directory } content = { children } componentParams = { { shouldUpdateScroll : this . shouldUpdateScroll } } / >
@ -215,6 +219,7 @@ class UI extends React.PureComponent {
intl : PropTypes . object . isRequired ,
intl : PropTypes . object . isRequired ,
dropdownMenuIsOpen : PropTypes . bool ,
dropdownMenuIsOpen : PropTypes . bool ,
layout : PropTypes . string . isRequired ,
layout : PropTypes . string . isRequired ,
firstLaunch : PropTypes . bool ,
} ;
} ;
state = {
state = {
@ -350,6 +355,12 @@ class UI extends React.PureComponent {
navigator . serviceWorker . addEventListener ( 'message' , this . handleServiceWorkerPostMessage ) ;
navigator . serviceWorker . addEventListener ( 'message' , this . handleServiceWorkerPostMessage ) ;
}
}
// On first launch, redirect to the follow recommendations page
if ( this . props . firstLaunch ) {
this . context . router . history . replace ( '/start' ) ;
this . props . dispatch ( closeOnboarding ( ) ) ;
}
this . props . dispatch ( fetchMarkers ( ) ) ;
this . props . dispatch ( fetchMarkers ( ) ) ;
this . props . dispatch ( expandHomeTimeline ( ) ) ;
this . props . dispatch ( expandHomeTimeline ( ) ) ;
this . props . dispatch ( expandNotifications ( ) ) ;
this . props . dispatch ( expandNotifications ( ) ) ;