@ -19,6 +19,8 @@ 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' ;
import TimelineHint from 'mastodon/components/timeline_hint' ;
import LimitedAccountHint from '../account_timeline/components/limited_account_hint' ;
import { getAccountHidden } from 'mastodon/selectors' ;
const mapStateToProps = ( state , { params : { acct , id } } ) => {
const mapStateToProps = ( state , { params : { acct , id } } ) => {
const accountId = id || state . getIn ( [ 'accounts_map' , acct ] ) ;
const accountId = id || state . getIn ( [ 'accounts_map' , acct ] ) ;
@ -37,6 +39,8 @@ const mapStateToProps = (state, { params: { acct, id } }) => {
accountIds : state . getIn ( [ 'user_lists' , 'followers' , accountId , 'items' ] ) ,
accountIds : state . getIn ( [ 'user_lists' , 'followers' , accountId , 'items' ] ) ,
hasMore : ! ! state . getIn ( [ 'user_lists' , 'followers' , accountId , 'next' ] ) ,
hasMore : ! ! state . getIn ( [ 'user_lists' , 'followers' , accountId , 'next' ] ) ,
isLoading : state . getIn ( [ 'user_lists' , 'followers' , accountId , 'isLoading' ] , true ) ,
isLoading : state . getIn ( [ 'user_lists' , 'followers' , accountId , 'isLoading' ] , true ) ,
suspended : state . getIn ( [ 'accounts' , accountId , 'suspended' ] , false ) ,
hidden : getAccountHidden ( state , accountId ) ,
blockedBy : state . getIn ( [ 'relationships' , accountId , 'blocked_by' ] , false ) ,
blockedBy : state . getIn ( [ 'relationships' , accountId , 'blocked_by' ] , false ) ,
} ;
} ;
} ;
} ;
@ -64,6 +68,8 @@ class Followers extends ImmutablePureComponent {
isLoading : PropTypes . bool ,
isLoading : PropTypes . bool ,
blockedBy : PropTypes . bool ,
blockedBy : PropTypes . bool ,
isAccount : PropTypes . bool ,
isAccount : PropTypes . bool ,
suspended : PropTypes . bool ,
hidden : PropTypes . bool ,
remote : PropTypes . bool ,
remote : PropTypes . bool ,
remoteUrl : PropTypes . string ,
remoteUrl : PropTypes . string ,
multiColumn : PropTypes . bool ,
multiColumn : PropTypes . bool ,
@ -101,7 +107,7 @@ class Followers extends ImmutablePureComponent {
} , 300 , { leading : true } ) ;
} , 300 , { leading : true } ) ;
render ( ) {
render ( ) {
const { accountId s, hasMore , blockedBy , isAccount , multiColumn , isLoading , remote , remoteUrl } = this . props ;
const { accountId , accountId s, hasMore , blockedBy , isAccount , multiColumn , isLoading , suspended , hidden , remote , remoteUrl } = this . props ;
if ( ! isAccount ) {
if ( ! isAccount ) {
return (
return (
@ -121,7 +127,13 @@ class Followers extends ImmutablePureComponent {
let emptyMessage ;
let emptyMessage ;
if ( blockedBy ) {
const forceEmptyState = blockedBy || suspended || hidden ;
if ( suspended ) {
emptyMessage = < FormattedMessage id = 'empty_column.account_suspended' defaultMessage = 'Account suspended' / > ;
} else if ( hidden ) {
emptyMessage = < LimitedAccountHint accountId = { accountId } / > ;
} else if ( blockedBy ) {
emptyMessage = < FormattedMessage id = 'empty_column.account_unavailable' defaultMessage = 'Profile unavailable' / > ;
emptyMessage = < FormattedMessage id = 'empty_column.account_unavailable' defaultMessage = 'Profile unavailable' / > ;
} else if ( remote && accountIds . isEmpty ( ) ) {
} else if ( remote && accountIds . isEmpty ( ) ) {
emptyMessage = < RemoteHint url = { remoteUrl } / > ;
emptyMessage = < RemoteHint url = { remoteUrl } / > ;
@ -137,7 +149,7 @@ class Followers extends ImmutablePureComponent {
< ScrollableList
< ScrollableList
scrollKey = 'followers'
scrollKey = 'followers'
hasMore = { hasMore }
hasMore = { ! forceEmptyState && hasMore }
isLoading = { isLoading }
isLoading = { isLoading }
onLoadMore = { this . handleLoadMore }
onLoadMore = { this . handleLoadMore }
prepend = { < HeaderContainer accountId = { this . props . accountId } hideTabs / > }
prepend = { < HeaderContainer accountId = { this . props . accountId } hideTabs / > }
@ -146,7 +158,7 @@ class Followers extends ImmutablePureComponent {
emptyMessage = { emptyMessage }
emptyMessage = { emptyMessage }
bindToDocument = { ! multiColumn }
bindToDocument = { ! multiColumn }
>
>
{ blockedBy ? [ ] : accountIds . map ( id =>
{ forceEmptyState ? [ ] : accountIds . map ( id =>
< AccountContainer key = { id } id = { id } withNote = { false } / > ,
< AccountContainer key = { id } id = { id } withNote = { false } / > ,
) }
) }
< / S c r o l l a b l e L i s t >
< / S c r o l l a b l e L i s t >