@@ -14,14 +14,17 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
1414import { FormattedMessage } from 'react-intl' ;
1515import { fetchAccountIdentityProofs } from '../../actions/identity_proofs' ;
1616
17+ const emptyList = ImmutableList ( ) ;
18+
1719const mapStateToProps = ( state , { params : { accountId } , withReplies = false } ) => {
1820 const path = withReplies ? `${ accountId } :with_replies` : accountId ;
1921
2022 return {
21- statusIds : state . getIn ( [ 'timelines' , `account:${ path } ` , 'items' ] , ImmutableList ( ) ) ,
22- featuredStatusIds : withReplies ? ImmutableList ( ) : state . getIn ( [ 'timelines' , `account:${ accountId } :pinned` , 'items' ] , ImmutableList ( ) ) ,
23+ statusIds : state . getIn ( [ 'timelines' , `account:${ path } ` , 'items' ] , emptyList ) ,
24+ featuredStatusIds : withReplies ? ImmutableList ( ) : state . getIn ( [ 'timelines' , `account:${ accountId } :pinned` , 'items' ] , emptyList ) ,
2325 isLoading : state . getIn ( [ 'timelines' , `account:${ path } ` , 'isLoading' ] ) ,
24- hasMore : state . getIn ( [ 'timelines' , `account:${ path } ` , 'hasMore' ] ) ,
26+ hasMore : state . getIn ( [ 'timelines' , `account:${ path } ` , 'hasMore' ] ) ,
27+ blockedBy : state . getIn ( [ 'relationships' , accountId , 'blocked_by' ] , false ) ,
2528 } ;
2629} ;
2730
@@ -37,26 +40,31 @@ class AccountTimeline extends ImmutablePureComponent {
3740 isLoading : PropTypes . bool ,
3841 hasMore : PropTypes . bool ,
3942 withReplies : PropTypes . bool ,
43+ blockedBy : PropTypes . bool ,
4044 } ;
4145
4246 componentWillMount ( ) {
4347 const { params : { accountId } , withReplies } = this . props ;
4448
4549 this . props . dispatch ( fetchAccount ( accountId ) ) ;
4650 this . props . dispatch ( fetchAccountIdentityProofs ( accountId ) ) ;
51+
4752 if ( ! withReplies ) {
4853 this . props . dispatch ( expandAccountFeaturedTimeline ( accountId ) ) ;
4954 }
55+
5056 this . props . dispatch ( expandAccountTimeline ( accountId , { withReplies } ) ) ;
5157 }
5258
5359 componentWillReceiveProps ( nextProps ) {
5460 if ( ( nextProps . params . accountId !== this . props . params . accountId && nextProps . params . accountId ) || nextProps . withReplies !== this . props . withReplies ) {
5561 this . props . dispatch ( fetchAccount ( nextProps . params . accountId ) ) ;
5662 this . props . dispatch ( fetchAccountIdentityProofs ( nextProps . params . accountId ) ) ;
63+
5764 if ( ! nextProps . withReplies ) {
5865 this . props . dispatch ( expandAccountFeaturedTimeline ( nextProps . params . accountId ) ) ;
5966 }
67+
6068 this . props . dispatch ( expandAccountTimeline ( nextProps . params . accountId , { withReplies : nextProps . params . withReplies } ) ) ;
6169 }
6270 }
@@ -66,7 +74,7 @@ class AccountTimeline extends ImmutablePureComponent {
6674 }
6775
6876 render ( ) {
69- const { shouldUpdateScroll, statusIds, featuredStatusIds, isLoading, hasMore } = this . props ;
77+ const { shouldUpdateScroll, statusIds, featuredStatusIds, isLoading, hasMore, blockedBy } = this . props ;
7078
7179 if ( ! statusIds && isLoading ) {
7280 return (
@@ -76,6 +84,8 @@ class AccountTimeline extends ImmutablePureComponent {
7684 ) ;
7785 }
7886
87+ const emptyMessage = blockedBy ? < FormattedMessage id = 'empty_column.account_timeline_blocked' defaultMessage = 'You are blocked' /> : < FormattedMessage id = 'empty_column.account_timeline' defaultMessage = 'No toots here!' /> ;
88+
7989 return (
8090 < Column >
8191 < ColumnBackButton />
@@ -84,13 +94,13 @@ class AccountTimeline extends ImmutablePureComponent {
8494 prepend = { < HeaderContainer accountId = { this . props . params . accountId } /> }
8595 alwaysPrepend
8696 scrollKey = 'account_timeline'
87- statusIds = { statusIds }
97+ statusIds = { blockedBy ? emptyList : statusIds }
8898 featuredStatusIds = { featuredStatusIds }
8999 isLoading = { isLoading }
90100 hasMore = { hasMore }
91101 onLoadMore = { this . handleLoadMore }
92102 shouldUpdateScroll = { shouldUpdateScroll }
93- emptyMessage = { < FormattedMessage id = 'empty_column.account_timeline' defaultMessage = 'No toots here!' /> }
103+ emptyMessage = { emptyMessage }
94104 />
95105 </ Column >
96106 ) ;
0 commit comments