lbry-desktop/ui/component/publishName/index.js
infinite-persistence 3f805a6189 doCheckPublishNameAvailability: case-insensitive version
## Issue
??

## Behavioral Changes
- Use `claim_search` instead of `claim_list` to retrieve all all own claims with the same name (case-insensitive).
  - Caveat: annonymous posts will be excluded.
- When a clash occurs, there is a possibility that we have multiple existing entries (e.g. "xxX", "xXx"). Since we don't know which one is best to fall back, I removed the "edit" button for this and replaced with a simpler text

## Code Note
- If not mistaken, the rest of the code still needs `selectMyClaimForUri` to be case-sensitive, so augment the selector to support both through an optional parameter.
2022-04-18 00:44:11 -04:00

32 lines
1.2 KiB
JavaScript

import { connect } from 'react-redux';
import { doUpdatePublishForm, doPrepareEdit } from 'redux/actions/publish';
import {
makeSelectPublishFormValue,
selectIsStillEditing,
selectMyClaimForUri,
selectTakeOverAmount,
selectCurrentUploads,
} from 'redux/selectors/publish';
import { selectActiveChannelClaim, selectIncognito } from 'redux/selectors/app';
import { doSetActiveChannel } from 'redux/actions/app';
import PublishPage from './view';
const select = (state) => ({
name: makeSelectPublishFormValue('name')(state),
uri: makeSelectPublishFormValue('uri')(state),
isStillEditing: selectIsStillEditing(state),
myClaimForUri: selectMyClaimForUri(state),
myClaimForUriCaseInsensitive: selectMyClaimForUri(state, false),
currentUploads: selectCurrentUploads(state),
activeChannelClaim: selectActiveChannelClaim(state),
incognito: selectIncognito(state),
amountNeededForTakeover: selectTakeOverAmount(state),
});
const perform = (dispatch) => ({
updatePublishForm: (value) => dispatch(doUpdatePublishForm(value)),
prepareEdit: (claim, uri) => dispatch(doPrepareEdit(claim, uri)),
setActiveChannel: (claimId) => dispatch(doSetActiveChannel(claimId)),
});
export default connect(select, perform)(PublishPage);