X-Git-Url: http://these/git/?a=blobdiff_plain;f=src%2Fshared%2Fcomponents%2Fcomment%2Fcomment-node.tsx;h=c6b37fdb2636f8d1589704d5c3b687082c7236f6;hb=9869b911cf480ee88c7b1e7d2f689cc2e1c65157;hp=079edec7cf4a60628f5cdb575352a909f293334d;hpb=8f1b0ad55920f6756a88525d678983b83428459b;p=lemmy-ui.git diff --git a/src/shared/components/comment/comment-node.tsx b/src/shared/components/comment/comment-node.tsx index 079edec..c6b37fd 100644 --- a/src/shared/components/comment/comment-node.tsx +++ b/src/shared/components/comment/comment-node.tsx @@ -1,7 +1,6 @@ import { colorList, getCommentParentId, - getRoleLabelPill, myAuth, myAuthRequired, showScores, @@ -63,6 +62,7 @@ import { I18NextService, UserService } from "../../services"; import { setupTippy } from "../../tippy"; import { Icon, PurgeWarning, Spinner } from "../common/icon"; import { MomentTime } from "../common/moment-time"; +import { UserBadges } from "../common/user-badges"; import { VoteButtonsCompact } from "../common/vote-buttons"; import { CommunityLink } from "../community/community-link"; import { PersonListing } from "../person/person-listing"; @@ -197,6 +197,17 @@ export class CommentNode extends Component { return this.commentView.comment.id; } + get hasBadges(): boolean { + const cv = this.commentView; + + return ( + this.isPostCreator || + isMod(cv.creator.id, this.props.moderators) || + isAdmin(cv.creator.id, this.props.admins) || + cv.creator.bot_account + ); + } + componentWillReceiveProps( nextProps: Readonly<{ children?: InfernoNode } & CommentNodeProps> ): void { @@ -310,41 +321,19 @@ export class CommentNode extends Component { /> - - - + {cv.comment.distinguished && ( - + )} - {this.isPostCreator && - getRoleLabelPill({ - label: I18NextService.i18n.t("op").toUpperCase(), - tooltip: I18NextService.i18n.t("creator"), - classes: "text-bg-info text-black", - shrink: false, - })} - - {isMod_ && - getRoleLabelPill({ - label: I18NextService.i18n.t("mod"), - tooltip: I18NextService.i18n.t("mod"), - classes: "text-bg-primary text-black", - })} - - {isAdmin_ && - getRoleLabelPill({ - label: I18NextService.i18n.t("admin"), - tooltip: I18NextService.i18n.t("admin"), - classes: "text-bg-danger text-white", - })} - - {cv.creator.bot_account && - getRoleLabelPill({ - label: I18NextService.i18n.t("bot_account").toLowerCase(), - tooltip: I18NextService.i18n.t("bot_account"), - })} + {this.props.showCommunity && ( <>