Don't fetch identity proofs unless logged in

merge-requests/1/head
Alex Gleason 2020-04-10 19:49:05 -05:00
rodzic 0a667052b9
commit a47781fb95
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
2 zmienionych plików z 7 dodań i 5 usunięć

Wyświetl plik

@ -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,
});

Wyświetl plik

@ -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));