Fix naming convention and type correctness

- Fixed value props being named like a function/selector.
- Fixed flow type for membership (should be `?string`).
    - It might not matter in the current code, but the whole purpose of type checking to catch usage errors in the future.
- `hasXXX` indicates a boolean, so it doesn't make sense to force the client to input a string.
This commit is contained in:
infinite-persistence 2022-06-28 13:14:06 +08:00
parent 1933997276
commit 96cdf11567
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0
4 changed files with 8 additions and 8 deletions

View file

@ -42,7 +42,7 @@ const select = (state, props) => {
stakedLevel: selectStakedLevelForChannelUri(state, channel_url),
linkedCommentAncestors: selectFetchedCommentAncestors(state),
totalReplyPages: makeSelectTotalReplyPagesForParentId(comment_id)(state),
selectOdyseeMembershipForUri: channel_url && selectOdyseeMembershipForUri(state, channel_url),
commenterMembership: channel_url && selectOdyseeMembershipForUri(state, channel_url),
repliesFetching: selectIsFetchingCommentsForParentId(state, comment_id),
fetchedReplies: selectRepliesForParentId(state, comment_id),
};

View file

@ -81,7 +81,7 @@ type Props = {
supportDisabled: boolean,
setQuickReply: (any) => void,
quickReply: any,
selectOdyseeMembershipForUri: string,
commenterMembership: ?string,
fetchedReplies: Array<Comment>,
repliesFetching: boolean,
threadLevel?: number,
@ -114,7 +114,7 @@ function CommentView(props: Props) {
supportDisabled,
setQuickReply,
quickReply,
selectOdyseeMembershipForUri,
commenterMembership,
fetchedReplies,
repliesFetching,
threadLevel = 0,
@ -316,7 +316,7 @@ function CommentView(props: Props) {
)}
{isGlobalMod && <CommentBadge label={__('Admin')} icon={ICONS.BADGE_ADMIN} />}
{isModerator && <CommentBadge label={__('Moderator')} icon={ICONS.BADGE_MOD} />}
<PremiumBadge membership={selectOdyseeMembershipForUri} linkPage />
<PremiumBadge membership={commenterMembership} linkPage />
<Button
className="comment__time"
onClick={handleTimeClick}
@ -395,7 +395,7 @@ function CommentView(props: Props) {
promptLinks
parentCommentId={commentId}
stakedLevel={stakedLevel}
hasMembership={selectOdyseeMembershipForUri}
hasMembership={Boolean(commenterMembership)}
/>
</Expandable>
) : (
@ -404,7 +404,7 @@ function CommentView(props: Props) {
promptLinks
parentCommentId={commentId}
stakedLevel={stakedLevel}
hasMembership={selectOdyseeMembershipForUri}
hasMembership={Boolean(commenterMembership)}
/>
)}
</div>

View file

@ -59,7 +59,7 @@ type MarkdownProps = {
disableTimestamps?: boolean,
stakedLevel?: number,
setUserMention?: (boolean) => void,
hasMembership?: string,
hasMembership?: boolean,
};
// ****************************************************************************

View file

@ -140,7 +140,7 @@ export default function LivestreamComment(props: Props) {
stakedLevel={stakedLevel}
disableTimestamps
setUserMention={setUserMention}
hasMembership={odyseeMembership}
hasMembership={Boolean(odyseeMembership)}
/>
)}
</div>