lbry-desktop/ui/modal/modalBlockChannel/index.js
infinite-persistence 4267c1ccf7
Un-authenticated resolve (#341)
* apiCall: add option to not send the auth header

## Why
Want an option to make un-authenticated `resolve` calls where appropriate, to improve caching.

## How
All `apiCall`s are authenticated by default, but when clients add NO_AUTH to the params, `apiCall` will exclude the X_LBRY_AUTH_TOKEN. It will also strip NO_AUTH from the param object before sending it out.

* Add hook for 'resolve' and 'claim_search' to check and skip auth...

... if the params does not contain anything that requires the wallet.

* doResolveUri, doClaimSearch: let clients decide when to include_my_output

- No more hardcoding 'include_purchase_receipt' and 'include_is_my_output'
- doResolveUri: include these params when opening a file page. This was the only place that was doing that prior to this PR.

* is_my_output: use the signing_channel as alternative

## Notes
`is_my_output` is more expensive to resolve, so it is not being requested all the time.

## Change
Looking at the signing channel as the additional fallback, on top of `myClaimIds`.

## Aside
I think using `myClaimIds` here is redundant, as it is usually populated from `is_my_ouput`. But leaving as is for now...
2021-11-24 09:33:34 -05:00

27 lines
972 B
JavaScript

import { connect } from 'react-redux';
import { selectClaimForUri, selectClaimIsMine } from 'redux/selectors/claims';
import { doHideModal } from 'redux/actions/app';
import { doCommentModBlock, doCommentModBlockAsAdmin, doCommentModBlockAsModerator } from 'redux/actions/comments';
import { selectActiveChannelClaim } from 'redux/selectors/app';
import { selectModerationDelegatorsById } from 'redux/selectors/comments';
import ModalBlockChannel from './view';
const select = (state, props) => {
const contentClaim = selectClaimForUri(state, props.contentUri);
return {
activeChannelClaim: selectActiveChannelClaim(state),
contentClaim,
contentClaimIsMine: selectClaimIsMine(state, contentClaim),
moderationDelegatorsById: selectModerationDelegatorsById(state),
};
};
const perform = {
doHideModal,
doCommentModBlock,
doCommentModBlockAsAdmin,
doCommentModBlockAsModerator,
};
export default connect(select, perform)(ModalBlockChannel);