@ -17,8 +17,11 @@ import HeaderContainer from '../account_timeline/containers/header_container';
import ColumnBackButton from '../../components/column_back_button' ;
import ColumnBackButton from '../../components/column_back_button' ;
import ScrollableList from '../../components/scrollable_list' ;
import ScrollableList from '../../components/scrollable_list' ;
import MissingIndicator from 'mastodon/components/missing_indicator' ;
import MissingIndicator from 'mastodon/components/missing_indicator' ;
import TimelineHint from 'mastodon/components/timeline_hint' ;
const mapStateToProps = ( state , props ) => ( {
const mapStateToProps = ( state , props ) => ( {
remote : ! ! state . getIn ( [ 'accounts' , props . params . accountId , 'acct' ] ) !== state . getIn ( [ 'accounts' , props . params . accountId , 'username' ] ) ,
remoteUrl : state . getIn ( [ 'accounts' , props . params . accountId , 'url' ] ) ,
isAccount : ! ! state . getIn ( [ 'accounts' , props . params . accountId ] ) ,
isAccount : ! ! state . getIn ( [ 'accounts' , props . params . accountId ] ) ,
accountIds : state . getIn ( [ 'user_lists' , 'following' , props . params . accountId , 'items' ] ) ,
accountIds : state . getIn ( [ 'user_lists' , 'following' , props . params . accountId , 'items' ] ) ,
hasMore : ! ! state . getIn ( [ 'user_lists' , 'following' , props . params . accountId , 'next' ] ) ,
hasMore : ! ! state . getIn ( [ 'user_lists' , 'following' , props . params . accountId , 'next' ] ) ,
@ -26,6 +29,14 @@ const mapStateToProps = (state, props) => ({
blockedBy : state . getIn ( [ 'relationships' , props . params . accountId , 'blocked_by' ] , false ) ,
blockedBy : state . getIn ( [ 'relationships' , props . params . accountId , 'blocked_by' ] , false ) ,
} ) ;
} ) ;
const RemoteHint = ( { url } ) => (
< TimelineHint url = { url } resource = { < FormattedMessage id = 'timeline_hint.resources.follows' defaultMessage = 'Follows' / > } / >
) ;
RemoteHint . propTypes = {
url : PropTypes . string . isRequired ,
} ;
export default @ connect ( mapStateToProps )
export default @ connect ( mapStateToProps )
class Following extends ImmutablePureComponent {
class Following extends ImmutablePureComponent {
@ -38,6 +49,8 @@ class Following extends ImmutablePureComponent {
isLoading : PropTypes . bool ,
isLoading : PropTypes . bool ,
blockedBy : PropTypes . bool ,
blockedBy : PropTypes . bool ,
isAccount : PropTypes . bool ,
isAccount : PropTypes . bool ,
remote : PropTypes . bool ,
remoteUrl : PropTypes . string ,
multiColumn : PropTypes . bool ,
multiColumn : PropTypes . bool ,
} ;
} ;
@ -60,7 +73,7 @@ class Following extends ImmutablePureComponent {
} , 300 , { leading : true } ) ;
} , 300 , { leading : true } ) ;
render ( ) {
render ( ) {
const { shouldUpdateScroll , accountIds , hasMore , blockedBy , isAccount , multiColumn , isLoading } = this . props ;
const { shouldUpdateScroll , accountIds , hasMore , blockedBy , isAccount , multiColumn , isLoading , remote , remoteUrl } = this . props ;
if ( ! isAccount ) {
if ( ! isAccount ) {
return (
return (
@ -78,7 +91,17 @@ class Following extends ImmutablePureComponent {
) ;
) ;
}
}
const emptyMessage = blockedBy ? < FormattedMessage id = 'empty_column.account_unavailable' defaultMessage = 'Profile unavailable' / > : < FormattedMessage id = 'account.follows.empty' defaultMessage = "This user doesn't follow anyone yet." / > ;
let emptyMessage ;
if ( blockedBy ) {
emptyMessage = < FormattedMessage id = 'empty_column.account_unavailable' defaultMessage = 'Profile unavailable' / > ;
} else if ( remote && accountIds . isEmpty ( ) ) {
emptyMessage = < RemoteHint url = { remoteUrl } / > ;
} else {
emptyMessage = < FormattedMessage id = 'account.follows.empty' defaultMessage = "This user doesn't follow anyone yet." / > ;
}
const remoteMessage = remote ? < RemoteHint url = { remoteUrl } / > : null ;
return (
return (
< Column >
< Column >
@ -92,6 +115,7 @@ class Following extends ImmutablePureComponent {
shouldUpdateScroll = { shouldUpdateScroll }
shouldUpdateScroll = { shouldUpdateScroll }
prepend = { < HeaderContainer accountId = { this . props . params . accountId } hideTabs / > }
prepend = { < HeaderContainer accountId = { this . props . params . accountId } hideTabs / > }
alwaysPrepend
alwaysPrepend
append = { remoteMessage }
emptyMessage = { emptyMessage }
emptyMessage = { emptyMessage }
bindToDocument = { ! multiColumn }
bindToDocument = { ! multiColumn }
>
>