lbry-desktop/ui/component/comment/index.js
infinite-persistence 0947393912
Comments: inline image not working for level4/5 channels
## Ticket
852 Markdown inline images in comments don't work for any channel level

## Change
The prior commit simplified the props from individual comment fields to just 1 `Comment` object, but there was a typo in the parameter where it should be `channel_url` instead of `author_uri`.
2022-02-14 13:15:28 +08:00

54 lines
2 KiB
JavaScript

import { connect } from 'react-redux';
import {
selectStakedLevelForChannelUri,
makeSelectClaimForUri,
selectThumbnailForUri,
selectHasChannels,
selectMyClaimIdsRaw,
} from 'redux/selectors/claims';
import { doCommentUpdate, doCommentList } from 'redux/actions/comments';
import { makeSelectChannelIsMuted } from 'redux/selectors/blocked';
import { doToast } from 'redux/actions/notifications';
import { doClearPlayingUri } from 'redux/actions/content';
import { selectUserVerifiedEmail } from 'redux/selectors/user';
import {
selectLinkedCommentAncestors,
selectOthersReactsForComment,
makeSelectTotalReplyPagesForParentId,
} from 'redux/selectors/comments';
import { selectActiveChannelClaim } from 'redux/selectors/app';
import { selectPlayingUri } from 'redux/selectors/content';
import Comment from './view';
const select = (state, props) => {
const { comment, uri } = props;
const { comment_id, channel_url } = comment || {};
const activeChannelClaim = selectActiveChannelClaim(state);
const activeChannelId = activeChannelClaim && activeChannelClaim.claim_id;
const reactionKey = activeChannelId ? `${comment_id}:${activeChannelId}` : comment_id;
return {
myChannelIds: selectMyClaimIdsRaw(state),
claim: makeSelectClaimForUri(uri)(state),
thumbnail: channel_url && selectThumbnailForUri(state, channel_url),
channelIsBlocked: channel_url && makeSelectChannelIsMuted(channel_url)(state),
commentingEnabled: IS_WEB ? Boolean(selectUserVerifiedEmail(state)) : true,
othersReacts: selectOthersReactsForComment(state, reactionKey),
activeChannelClaim,
hasChannels: selectHasChannels(state),
playingUri: selectPlayingUri(state),
stakedLevel: selectStakedLevelForChannelUri(state, channel_url),
linkedCommentAncestors: selectLinkedCommentAncestors(state),
totalReplyPages: makeSelectTotalReplyPagesForParentId(comment_id)(state),
};
};
const perform = {
doClearPlayingUri,
updateComment: doCommentUpdate,
fetchReplies: doCommentList,
doToast,
};
export default connect(select, perform)(Comment);