X-Git-Url: http://these/git/?a=blobdiff_plain;f=src%2Fshared%2Fcomponents%2Fcomment%2Fcomment-node.tsx;h=662b67be4655ed962bf051c21713a812d67a9b63;hb=61867ee73d7ba9ac6865bd6fcd1ba11f51a5f060;hp=d38a7af90b67e6801184337e48442a2d1039c784;hpb=787a75396be6132a9a2e3b427d8013d56a2f7c79;p=lemmy-ui.git diff --git a/src/shared/components/comment/comment-node.tsx b/src/shared/components/comment/comment-node.tsx index d38a7af..662b67b 100644 --- a/src/shared/components/comment/comment-node.tsx +++ b/src/shared/components/comment/comment-node.tsx @@ -15,6 +15,9 @@ import { isMod, } from "@utils/roles"; import classNames from "classnames"; +import isBefore from "date-fns/isBefore"; +import parseISO from "date-fns/parseISO"; +import subMinutes from "date-fns/subMinutes"; import { Component, InfernoNode, linkEvent } from "inferno"; import { Link } from "inferno-router"; import { @@ -45,19 +48,21 @@ import { SaveComment, TransferCommunity, } from "lemmy-js-client"; -import moment from "moment"; +import deepEqual from "lodash.isequal"; import { commentTreeMaxDepth } from "../../config"; import { BanType, CommentNodeI, CommentViewType, PurgeType, + VoteContentType, } from "../../interfaces"; import { mdToHtml, mdToHtmlNoImages } from "../../markdown"; 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"; @@ -195,7 +200,7 @@ export class CommentNode extends Component { componentWillReceiveProps( nextProps: Readonly<{ children?: InfernoNode } & CommentNodeProps> ): void { - if (this.props != nextProps) { + if (!deepEqual(this.props, nextProps)) { this.setState({ showReply: false, showEdit: false, @@ -304,32 +309,21 @@ export class CommentNode extends Component { classes="icon-inline" /> - - - + + + {cv.comment.distinguished && ( - - )} - {this.isPostCreator && ( -
- {I18NextService.i18n.t("creator")} -
- )} - {isMod_ && ( -
- {I18NextService.i18n.t("mod")} -
- )} - {isAdmin_ && ( -
- {I18NextService.i18n.t("admin")} -
- )} - {cv.creator.bot_account && ( -
- {I18NextService.i18n.t("bot_account").toLowerCase()} -
+ )} + + + {this.props.showCommunity && ( <> {I18NextService.i18n.t("to")} @@ -340,7 +334,9 @@ export class CommentNode extends Component { )} - {this.linkBtn(true)} + + {this.getLinkButton(true)} + {cv.comment.language_id !== 0 && ( { @@ -356,7 +352,7 @@ export class CommentNode extends Component { {showScores() && ( <> { } /> )} -
- {this.props.showContext && this.linkBtn()} +
+ {this.props.showContext && this.getLinkButton()} {this.props.markable && (