X-Git-Url: http://these/git/?a=blobdiff_plain;f=src%2Fshared%2Fcomponents%2Fcomment%2Fcomment-node.tsx;h=7b7f29e5cbc5fda864a6df18f9dfb201150d597f;hb=2911cd8cdb348629a97d60239723b1925210df0a;hp=b558d142ce9f10646f8cfe30ebe84f68a90e1609;hpb=a9bcf0567d815afcfbe1775bff3dc1eea66c1c18;p=lemmy-ui.git diff --git a/src/shared/components/comment/comment-node.tsx b/src/shared/components/comment/comment-node.tsx index b558d14..7b7f29e 100644 --- a/src/shared/components/comment/comment-node.tsx +++ b/src/shared/components/comment/comment-node.tsx @@ -3,7 +3,6 @@ import { getCommentParentId, myAuth, myAuthRequired, - newVote, showScores, } from "@utils/app"; import { futureDaysToUnixTime, numToSI } from "@utils/helpers"; @@ -16,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 { @@ -46,20 +48,22 @@ 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, - VoteType, + 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"; import { CommentForm } from "./comment-form"; @@ -110,7 +114,7 @@ interface CommentNodeProps { moderators?: CommunityModeratorView[]; admins?: PersonView[]; noBorder?: boolean; - noIndent?: boolean; + isTopLevel?: boolean; viewOnly?: boolean; locked?: boolean; markable?: boolean; @@ -196,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, @@ -280,7 +284,7 @@ export class CommentNode extends Component { node.comment_view.counts.child_count > 0; return ( -
  • +
  • { mark: this.isCommentNew || this.commentView.comment.distinguished, })} > -
    +
    - - - + + + {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")} @@ -341,7 +330,9 @@ export class CommentNode extends Component { )} - {this.linkBtn(true)} + + {this.getLinkButton(true)} + {cv.comment.language_id !== 0 && ( { @@ -353,29 +344,18 @@ export class CommentNode extends Component { )} {/* This is an expanding spacer for mobile */}
    + {showScores() && ( <> - - {this.state.upvoteLoading ? ( - - ) : ( - - {numToSI(this.commentView.counts.score)} - - )} - + {numToSI(this.commentView.counts.score)} + • )} @@ -417,8 +397,8 @@ export class CommentNode extends Component { } /> )} -
    - {this.props.showContext && this.linkBtn()} +
    + {this.props.showContext && this.getLinkButton()} {this.props.markable && ( - {this.props.enableDownvotes && ( - - )} +