Don't fetch identity proofs unless logged in
This commit is contained in:
parent
0a667052b9
commit
a47781fb95
2 changed files with 7 additions and 5 deletions
|
@ -23,8 +23,8 @@ export const fetchAccountIdentityProofsSuccess = (accountId, identity_proofs) =>
|
||||||
identity_proofs,
|
identity_proofs,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchAccountIdentityProofsFail = (accountId, err) => ({
|
export const fetchAccountIdentityProofsFail = (accountId, error) => ({
|
||||||
type: IDENTITY_PROOFS_ACCOUNT_FETCH_FAIL,
|
type: IDENTITY_PROOFS_ACCOUNT_FETCH_FAIL,
|
||||||
accountId,
|
accountId,
|
||||||
err,
|
error,
|
||||||
});
|
});
|
||||||
|
|
|
@ -48,6 +48,7 @@ const mapStateToProps = (state, { params: { username }, withReplies = false }) =
|
||||||
featuredStatusIds: withReplies ? ImmutableList() : state.getIn(['timelines', `account:${accountId}:pinned`, 'items'], emptyList),
|
featuredStatusIds: withReplies ? ImmutableList() : state.getIn(['timelines', `account:${accountId}:pinned`, 'items'], emptyList),
|
||||||
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']),
|
||||||
|
me,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -67,11 +68,11 @@ class AccountTimeline extends ImmutablePureComponent {
|
||||||
};
|
};
|
||||||
|
|
||||||
componentWillMount () {
|
componentWillMount () {
|
||||||
const { params: { username }, accountId, withReplies } = this.props;
|
const { params: { username }, accountId, withReplies, me } = this.props;
|
||||||
|
|
||||||
if (accountId && accountId !== -1) {
|
if (accountId && accountId !== -1) {
|
||||||
this.props.dispatch(fetchAccount(accountId));
|
this.props.dispatch(fetchAccount(accountId));
|
||||||
this.props.dispatch(fetchAccountIdentityProofs(accountId));
|
if (me) this.props.dispatch(fetchAccountIdentityProofs(accountId));
|
||||||
|
|
||||||
if (!withReplies) {
|
if (!withReplies) {
|
||||||
this.props.dispatch(expandAccountFeaturedTimeline(accountId));
|
this.props.dispatch(expandAccountFeaturedTimeline(accountId));
|
||||||
|
@ -85,9 +86,10 @@ class AccountTimeline extends ImmutablePureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps (nextProps) {
|
componentWillReceiveProps (nextProps) {
|
||||||
|
const { me } = nextProps;
|
||||||
if (nextProps.accountId && nextProps.accountId !== -1 && (nextProps.accountId !== this.props.accountId && nextProps.accountId) || nextProps.withReplies !== this.props.withReplies) {
|
if (nextProps.accountId && nextProps.accountId !== -1 && (nextProps.accountId !== this.props.accountId && nextProps.accountId) || nextProps.withReplies !== this.props.withReplies) {
|
||||||
this.props.dispatch(fetchAccount(nextProps.accountId));
|
this.props.dispatch(fetchAccount(nextProps.accountId));
|
||||||
this.props.dispatch(fetchAccountIdentityProofs(nextProps.accountId));
|
if (me) this.props.dispatch(fetchAccountIdentityProofs(nextProps.accountId));
|
||||||
|
|
||||||
if (!nextProps.withReplies) {
|
if (!nextProps.withReplies) {
|
||||||
this.props.dispatch(expandAccountFeaturedTimeline(nextProps.accountId));
|
this.props.dispatch(expandAccountFeaturedTimeline(nextProps.accountId));
|
||||||
|
|
Loading…
Reference in a new issue