Skip 'include_is_my_output' for Incognito

Ticket: 1180

I believe the original intention was "if a claim was previously resolved, but without authentication (no `is_my_output` data), then resolve again with `include_is_my_output`"

Update to exclude that logic for Incognito.

## Aside
The check for `!canonicalUrl` is interesting:
- Are there claims that really don't have `canonical_url`?  If yes, would that end up in an infinite `resolve` loop?
This commit is contained in:
infinite-persistence 2022-04-07 09:16:37 +08:00 committed by Thomas Zarebczan
parent ee22775c7a
commit 7e65062613
2 changed files with 18 additions and 3 deletions

View file

@ -13,6 +13,7 @@ import {
makeSelectUrlsForCollectionId, makeSelectUrlsForCollectionId,
makeSelectIsResolvingCollectionForId, makeSelectIsResolvingCollectionForId,
} from 'redux/selectors/collections'; } from 'redux/selectors/collections';
import { selectUserVerifiedEmail } from 'redux/selectors/user';
import { doResolveUri } from 'redux/actions/claims'; import { doResolveUri } from 'redux/actions/claims';
import { doBeginPublish } from 'redux/actions/publish'; import { doBeginPublish } from 'redux/actions/publish';
import { doFetchItemsInCollection } from 'redux/actions/collections'; import { doFetchItemsInCollection } from 'redux/actions/collections';
@ -81,6 +82,7 @@ const select = (state, props) => {
collectionId, collectionId,
collectionUrls: makeSelectUrlsForCollectionId(collectionId)(state), collectionUrls: makeSelectUrlsForCollectionId(collectionId)(state),
isResolvingCollection: makeSelectIsResolvingCollectionForId(collectionId)(state), isResolvingCollection: makeSelectIsResolvingCollectionForId(collectionId)(state),
isAuthenticated: selectUserVerifiedEmail(state),
geoRestriction: selectGeoRestrictionForUri(state, uri), geoRestriction: selectGeoRestrictionForUri(state, uri),
}; };
}; };

View file

@ -35,6 +35,7 @@ type Props = {
collection: Collection, collection: Collection,
collectionUrls: Array<string>, collectionUrls: Array<string>,
isResolvingCollection: boolean, isResolvingCollection: boolean,
isAuthenticated: boolean,
geoRestriction: ?GeoRestriction, geoRestriction: ?GeoRestriction,
doResolveUri: (uri: string, returnCached: boolean, resolveReposts: boolean, options: any) => void, doResolveUri: (uri: string, returnCached: boolean, resolveReposts: boolean, options: any) => void,
doBeginPublish: (name: ?string) => void, doBeginPublish: (name: ?string) => void,
@ -56,6 +57,7 @@ export default function ShowPage(props: Props) {
collection, collection,
collectionUrls, collectionUrls,
isResolvingCollection, isResolvingCollection,
isAuthenticated,
geoRestriction, geoRestriction,
doResolveUri, doResolveUri,
doBeginPublish, doBeginPublish,
@ -122,16 +124,27 @@ export default function ShowPage(props: Props) {
if ( if (
(doResolveUri && !isResolvingUri && uri && haventFetchedYet) || (doResolveUri && !isResolvingUri && uri && haventFetchedYet) ||
(claimExists && !claimIsPending && (!canonicalUrl || isMine === undefined)) (claimExists && !claimIsPending && (!canonicalUrl || (isMine === undefined && isAuthenticated)))
) { ) {
doResolveUri( doResolveUri(
uri, uri,
false, false,
true, true,
isMine === undefined ? { include_is_my_output: true, include_purchase_receipt: true } : {} isMine === undefined && isAuthenticated ? { include_is_my_output: true, include_purchase_receipt: true } : {}
); );
} }
}, [doResolveUri, isResolvingUri, canonicalUrl, uri, claimExists, haventFetchedYet, isMine, claimIsPending, search]); }, [
doResolveUri,
isResolvingUri,
canonicalUrl,
uri,
claimExists,
haventFetchedYet,
isMine,
claimIsPending,
search,
isAuthenticated,
]);
// Don't navigate directly to repost urls // Don't navigate directly to repost urls
// Always redirect to the actual content // Always redirect to the actual content