|
@ -18,10 +18,11 @@ import TimelineHint from 'flavours/glitch/components/timeline_hint'; |
|
|
import LimitedAccountHint from './components/limited_account_hint'; |
|
|
import LimitedAccountHint from './components/limited_account_hint'; |
|
|
import { getAccountHidden } from 'flavours/glitch/selectors'; |
|
|
import { getAccountHidden } from 'flavours/glitch/selectors'; |
|
|
import { normalizeForLookup } from 'flavours/glitch/reducers/accounts_map'; |
|
|
import { normalizeForLookup } from 'flavours/glitch/reducers/accounts_map'; |
|
|
|
|
|
import { fetchFeaturedTags } from '../../actions/featured_tags'; |
|
|
|
|
|
|
|
|
const emptyList = ImmutableList(); |
|
|
const emptyList = ImmutableList(); |
|
|
|
|
|
|
|
|
const mapStateToProps = (state, { params: { acct, id }, withReplies = false }) => { |
|
|
|
|
|
|
|
|
const mapStateToProps = (state, { params: { acct, id, tagged }, withReplies = false }) => { |
|
|
const accountId = id || state.getIn(['accounts_map', normalizeForLookup(acct)]); |
|
|
const accountId = id || state.getIn(['accounts_map', normalizeForLookup(acct)]); |
|
|
|
|
|
|
|
|
if (!accountId) { |
|
|
if (!accountId) { |
|
@ -31,7 +32,7 @@ const mapStateToProps = (state, { params: { acct, id }, withReplies = false }) = |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const path = withReplies ? `${accountId}:with_replies` : accountId; |
|
|
|
|
|
|
|
|
const path = withReplies ? `${accountId}:with_replies` : `${accountId}${tagged ? `:${tagged}` : ''}`; |
|
|
|
|
|
|
|
|
return { |
|
|
return { |
|
|
accountId, |
|
|
accountId, |
|
@ -39,7 +40,7 @@ const mapStateToProps = (state, { params: { acct, id }, withReplies = false }) = |
|
|
remoteUrl: state.getIn(['accounts', accountId, 'url']), |
|
|
remoteUrl: state.getIn(['accounts', accountId, 'url']), |
|
|
isAccount: !!state.getIn(['accounts', accountId]), |
|
|
isAccount: !!state.getIn(['accounts', accountId]), |
|
|
statusIds: state.getIn(['timelines', `account:${path}`, 'items'], ImmutableList()), |
|
|
statusIds: state.getIn(['timelines', `account:${path}`, 'items'], ImmutableList()), |
|
|
featuredStatusIds: withReplies ? ImmutableList() : state.getIn(['timelines', `account:${accountId}:pinned`, 'items'], ImmutableList()), |
|
|
|
|
|
|
|
|
featuredStatusIds: withReplies ? ImmutableList() : state.getIn(['timelines', `account:${accountId}:pinned${tagged ? `:${tagged}` : ''}`, 'items'], ImmutableList()), |
|
|
isLoading: state.getIn(['timelines', `account:${path}`, 'isLoading']), |
|
|
isLoading: state.getIn(['timelines', `account:${path}`, 'isLoading']), |
|
|
hasMore: state.getIn(['timelines', `account:${path}`, 'hasMore']), |
|
|
hasMore: state.getIn(['timelines', `account:${path}`, 'hasMore']), |
|
|
suspended: state.getIn(['accounts', accountId, 'suspended'], false), |
|
|
suspended: state.getIn(['accounts', accountId, 'suspended'], false), |
|
@ -62,6 +63,7 @@ class AccountTimeline extends ImmutablePureComponent { |
|
|
params: PropTypes.shape({ |
|
|
params: PropTypes.shape({ |
|
|
acct: PropTypes.string, |
|
|
acct: PropTypes.string, |
|
|
id: PropTypes.string, |
|
|
id: PropTypes.string, |
|
|
|
|
|
tagged: PropTypes.string, |
|
|
}).isRequired, |
|
|
}).isRequired, |
|
|
accountId: PropTypes.string, |
|
|
accountId: PropTypes.string, |
|
|
dispatch: PropTypes.func.isRequired, |
|
|
dispatch: PropTypes.func.isRequired, |
|
@ -79,14 +81,16 @@ class AccountTimeline extends ImmutablePureComponent { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
_load () { |
|
|
_load () { |
|
|
const { accountId, withReplies, dispatch } = this.props; |
|
|
|
|
|
|
|
|
const { accountId, withReplies, params: { tagged }, dispatch } = this.props; |
|
|
|
|
|
|
|
|
dispatch(fetchAccount(accountId)); |
|
|
dispatch(fetchAccount(accountId)); |
|
|
|
|
|
|
|
|
if (!withReplies) { |
|
|
if (!withReplies) { |
|
|
dispatch(expandAccountFeaturedTimeline(accountId)); |
|
|
|
|
|
|
|
|
dispatch(expandAccountFeaturedTimeline(accountId, { tagged })); |
|
|
} |
|
|
} |
|
|
dispatch(expandAccountTimeline(accountId, { withReplies })); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dispatch(fetchFeaturedTags(accountId)); |
|
|
|
|
|
dispatch(expandAccountTimeline(accountId, { withReplies, tagged })); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
componentDidMount () { |
|
|
componentDidMount () { |
|
@ -100,12 +104,17 @@ class AccountTimeline extends ImmutablePureComponent { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
componentDidUpdate (prevProps) { |
|
|
componentDidUpdate (prevProps) { |
|
|
const { params: { acct }, accountId, dispatch } = this.props; |
|
|
|
|
|
|
|
|
const { params: { acct, tagged }, accountId, withReplies, dispatch } = this.props; |
|
|
|
|
|
|
|
|
if (prevProps.accountId !== accountId && accountId) { |
|
|
if (prevProps.accountId !== accountId && accountId) { |
|
|
this._load(); |
|
|
this._load(); |
|
|
} else if (prevProps.params.acct !== acct) { |
|
|
} else if (prevProps.params.acct !== acct) { |
|
|
dispatch(lookupAccount(acct)); |
|
|
dispatch(lookupAccount(acct)); |
|
|
|
|
|
} else if (prevProps.params.tagged !== tagged) { |
|
|
|
|
|
if (!withReplies) { |
|
|
|
|
|
dispatch(expandAccountFeaturedTimeline(accountId, { tagged })); |
|
|
|
|
|
} |
|
|
|
|
|
dispatch(expandAccountTimeline(accountId, { withReplies, tagged })); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -128,7 +137,7 @@ class AccountTimeline extends ImmutablePureComponent { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
handleLoadMore = maxId => { |
|
|
handleLoadMore = maxId => { |
|
|
this.props.dispatch(expandAccountTimeline(this.props.accountId, { maxId, withReplies: this.props.withReplies })); |
|
|
|
|
|
|
|
|
this.props.dispatch(expandAccountTimeline(this.props.accountId, { maxId, withReplies: this.props.withReplies, tagged: this.props.params.tagged })); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
setRef = c => { |
|
|
setRef = c => { |
|
@ -174,7 +183,7 @@ class AccountTimeline extends ImmutablePureComponent { |
|
|
<ProfileColumnHeader onClick={this.handleHeaderClick} multiColumn={multiColumn} /> |
|
|
<ProfileColumnHeader onClick={this.handleHeaderClick} multiColumn={multiColumn} /> |
|
|
|
|
|
|
|
|
<StatusList |
|
|
<StatusList |
|
|
prepend={<HeaderContainer accountId={this.props.accountId} hideTabs={forceEmptyState} />} |
|
|
|
|
|
|
|
|
prepend={<HeaderContainer accountId={this.props.accountId} hideTabs={forceEmptyState} tagged={this.props.params.tagged} />} |
|
|
alwaysPrepend |
|
|
alwaysPrepend |
|
|
append={remoteMessage} |
|
|
append={remoteMessage} |
|
|
scrollKey='account_timeline' |
|
|
scrollKey='account_timeline' |
|
|