From a47781fb957aa24694fb36965f11c861fae36442 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Fri, 10 Apr 2020 19:49:05 -0500 Subject: [PATCH] Don't fetch identity proofs unless logged in --- app/gabsocial/actions/identity_proofs.js | 4 ++-- app/gabsocial/features/account_timeline/index.js | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/gabsocial/actions/identity_proofs.js b/app/gabsocial/actions/identity_proofs.js index 449debf61..a14455a64 100644 --- a/app/gabsocial/actions/identity_proofs.js +++ b/app/gabsocial/actions/identity_proofs.js @@ -23,8 +23,8 @@ export const fetchAccountIdentityProofsSuccess = (accountId, identity_proofs) => identity_proofs, }); -export const fetchAccountIdentityProofsFail = (accountId, err) => ({ +export const fetchAccountIdentityProofsFail = (accountId, error) => ({ type: IDENTITY_PROOFS_ACCOUNT_FETCH_FAIL, accountId, - err, + error, }); diff --git a/app/gabsocial/features/account_timeline/index.js b/app/gabsocial/features/account_timeline/index.js index ba05ec511..56c1f9e90 100644 --- a/app/gabsocial/features/account_timeline/index.js +++ b/app/gabsocial/features/account_timeline/index.js @@ -48,6 +48,7 @@ const mapStateToProps = (state, { params: { username }, withReplies = false }) = featuredStatusIds: withReplies ? ImmutableList() : state.getIn(['timelines', `account:${accountId}:pinned`, 'items'], emptyList), isLoading: state.getIn(['timelines', `account:${path}`, 'isLoading']), hasMore: state.getIn(['timelines', `account:${path}`, 'hasMore']), + me, }; }; @@ -67,11 +68,11 @@ class AccountTimeline extends ImmutablePureComponent { }; componentWillMount () { - const { params: { username }, accountId, withReplies } = this.props; + const { params: { username }, accountId, withReplies, me } = this.props; if (accountId && accountId !== -1) { this.props.dispatch(fetchAccount(accountId)); - this.props.dispatch(fetchAccountIdentityProofs(accountId)); + if (me) this.props.dispatch(fetchAccountIdentityProofs(accountId)); if (!withReplies) { this.props.dispatch(expandAccountFeaturedTimeline(accountId)); @@ -85,9 +86,10 @@ class AccountTimeline extends ImmutablePureComponent { } componentWillReceiveProps (nextProps) { + const { me } = nextProps; 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(fetchAccountIdentityProofs(nextProps.accountId)); + if (me) this.props.dispatch(fetchAccountIdentityProofs(nextProps.accountId)); if (!nextProps.withReplies) { this.props.dispatch(expandAccountFeaturedTimeline(nextProps.accountId));