|
|
@ -15,12 +15,15 @@ import { ScrollContainer } from 'react-router-scroll-4'; |
|
|
|
import LoadMore from 'mastodon/components/load_more'; |
|
|
|
import MissingIndicator from 'mastodon/components/missing_indicator'; |
|
|
|
import { openModal } from 'mastodon/actions/modal'; |
|
|
|
import { FormattedMessage } from 'react-intl'; |
|
|
|
|
|
|
|
const mapStateToProps = (state, props) => ({ |
|
|
|
isAccount: !!state.getIn(['accounts', props.params.accountId]), |
|
|
|
attachments: getAccountGallery(state, props.params.accountId), |
|
|
|
isLoading: state.getIn(['timelines', `account:${props.params.accountId}:media`, 'isLoading']), |
|
|
|
hasMore: state.getIn(['timelines', `account:${props.params.accountId}:media`, 'hasMore']), |
|
|
|
suspended: state.getIn(['accounts', props.params.accountId, 'suspended'], false), |
|
|
|
blockedBy: state.getIn(['relationships', props.params.accountId, 'blocked_by'], false), |
|
|
|
}); |
|
|
|
|
|
|
|
class LoadMoreMedia extends ImmutablePureComponent { |
|
|
@ -56,6 +59,8 @@ class AccountGallery extends ImmutablePureComponent { |
|
|
|
isLoading: PropTypes.bool, |
|
|
|
hasMore: PropTypes.bool, |
|
|
|
isAccount: PropTypes.bool, |
|
|
|
blockedBy: PropTypes.bool, |
|
|
|
suspended: PropTypes.bool, |
|
|
|
multiColumn: PropTypes.bool, |
|
|
|
}; |
|
|
|
|
|
|
@ -119,7 +124,7 @@ class AccountGallery extends ImmutablePureComponent { |
|
|
|
} |
|
|
|
|
|
|
|
render () { |
|
|
|
const { attachments, shouldUpdateScroll, isLoading, hasMore, isAccount, multiColumn } = this.props; |
|
|
|
const { attachments, shouldUpdateScroll, isLoading, hasMore, isAccount, multiColumn, blockedBy, suspended } = this.props; |
|
|
|
const { width } = this.state; |
|
|
|
|
|
|
|
if (!isAccount) { |
|
|
@ -152,15 +157,21 @@ class AccountGallery extends ImmutablePureComponent { |
|
|
|
<div className='scrollable scrollable--flex' onScroll={this.handleScroll}> |
|
|
|
<HeaderContainer accountId={this.props.params.accountId} /> |
|
|
|
|
|
|
|
<div role='feed' className='account-gallery__container' ref={this.handleRef}> |
|
|
|
{attachments.map((attachment, index) => attachment === null ? ( |
|
|
|
<LoadMoreMedia key={'more:' + attachments.getIn(index + 1, 'id')} maxId={index > 0 ? attachments.getIn(index - 1, 'id') : null} onLoadMore={this.handleLoadMore} /> |
|
|
|
) : ( |
|
|
|
<MediaItem key={attachment.get('id')} attachment={attachment} displayWidth={width} onOpenMedia={this.handleOpenMedia} /> |
|
|
|
))} |
|
|
|
|
|
|
|
{loadOlder} |
|
|
|
</div> |
|
|
|
{(suspended || blockedBy) ? ( |
|
|
|
<div className='empty-column-indicator'> |
|
|
|
<FormattedMessage id='empty_column.account_unavailable' defaultMessage='Profile unavailable' /> |
|
|
|
</div> |
|
|
|
) : ( |
|
|
|
<div role='feed' className='account-gallery__container' ref={this.handleRef}> |
|
|
|
{attachments.map((attachment, index) => attachment === null ? ( |
|
|
|
<LoadMoreMedia key={'more:' + attachments.getIn(index + 1, 'id')} maxId={index > 0 ? attachments.getIn(index - 1, 'id') : null} onLoadMore={this.handleLoadMore} /> |
|
|
|
) : ( |
|
|
|
<MediaItem key={attachment.get('id')} attachment={attachment} displayWidth={width} onOpenMedia={this.handleOpenMedia} /> |
|
|
|
))} |
|
|
|
|
|
|
|
{loadOlder} |
|
|
|
</div> |
|
|
|
)} |
|
|
|
|
|
|
|
{isLoading && attachments.size === 0 && ( |
|
|
|
<div className='scrollable__append'> |
|
|
|