lbry-desktop/ui/component/commentCreate/index.js
infinite-persistence 208b701998 Fix comment channel not checked in Livestreams
## Change
Moved the fetch from `CommentList` to `CommentCreate` instead, which is used by both Content and Livestreams comments.
2022-05-06 11:31:42 -04:00

70 lines
2.3 KiB
JavaScript

import { connect } from 'react-redux';
import {
selectClaimForUri,
selectClaimIsMine,
selectHasChannels,
selectFetchingMyChannels,
makeSelectTagInClaimOrChannelForUri,
selectMyChannelClaimIds,
} from 'redux/selectors/claims';
import { CommentCreate } from './view';
import { DISABLE_SUPPORT_TAG } from 'constants/tags';
import {
doCommentCreate,
doFetchCreatorSettings,
doCommentById,
doFetchMyCommentedChannels,
} from 'redux/actions/comments';
import { doSendTip, doSendCashTip } from 'redux/actions/wallet';
import { doToast } from 'redux/actions/notifications';
import { selectActiveChannelClaim } from 'redux/selectors/app';
import { selectMyCommentedChannelIdsForId, selectSettingsByChannelId } from 'redux/selectors/comments';
import { getChannelIdFromClaim } from 'util/claim';
import { doOpenModal } from 'redux/actions/app';
import { selectClientSetting } from 'redux/selectors/settings';
import * as SETTINGS from 'constants/settings';
const select = (state, props) => {
const { uri } = props;
const claim = selectClaimForUri(state, uri);
const { claim_id: claimId, name, signing_channel: channel } = claim || {};
// setup variables for tip API
const channelClaimId = getChannelIdFromClaim(claim);
const tipChannelName = channel ? channel.name : name;
const activeChannelClaim = selectActiveChannelClaim(state);
const { claim_id: activeChannelClaimId, name: activeChannelName, canonical_url: activeChannelUrl } =
activeChannelClaim || {};
return {
activeChannelClaimId,
activeChannelName,
activeChannelUrl,
hasChannels: selectHasChannels(state),
claimId,
channelClaimId,
tipChannelName,
claimIsMine: selectClaimIsMine(state, claim),
isFetchingChannels: selectFetchingMyChannels(state),
settingsByChannelId: selectSettingsByChannelId(state),
supportDisabled: makeSelectTagInClaimOrChannelForUri(uri, DISABLE_SUPPORT_TAG)(state),
preferredCurrency: selectClientSetting(state, SETTINGS.PREFERRED_CURRENCY),
myChannelClaimIds: selectMyChannelClaimIds(state),
myCommentedChannelIds: selectMyCommentedChannelIdsForId(state, claim?.claim_id),
};
};
const perform = {
doCommentCreate,
doFetchCreatorSettings,
doFetchMyCommentedChannels,
doToast,
doCommentById,
doSendCashTip,
doSendTip,
doOpenModal,
};
export default connect(select, perform)(CommentCreate);