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), stakedLevel: selectStakedLevelForChannelUri(state, channel_url),
linkedCommentAncestors: selectFetchedCommentAncestors(state), linkedCommentAncestors: selectFetchedCommentAncestors(state),
totalReplyPages: makeSelectTotalReplyPagesForParentId(comment_id)(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), repliesFetching: selectIsFetchingCommentsForParentId(state, comment_id),
fetchedReplies: selectRepliesForParentId(state, comment_id), fetchedReplies: selectRepliesForParentId(state, comment_id),
}; };

View file

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

View file

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

View file

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