1 import { Component, linkEvent } from 'inferno';
2 import { Link } from 'inferno-router';
4 CommentNode as CommentNodeI,
9 MarkUserMentionAsReadForm,
15 AddModToCommunityForm,
17 TransferCommunityForm,
22 } from '../interfaces';
23 import { WebSocketService, UserService } from '../services';
32 import moment from 'moment';
33 import { MomentTime } from './moment-time';
34 import { CommentForm } from './comment-form';
35 import { CommentNodes } from './comment-nodes';
36 import { UserListing } from './user-listing';
37 import { CommunityLink } from './community-link';
38 import { i18n } from '../i18next';
40 interface CommentNodeState {
43 showRemoveDialog: boolean;
45 showBanDialog: boolean;
49 showConfirmTransferSite: boolean;
50 showConfirmTransferCommunity: boolean;
51 showConfirmAppointAsMod: boolean;
52 showConfirmAppointAsAdmin: boolean;
55 showAdvanced: boolean;
65 interface CommentNodeProps {
72 showContext?: boolean;
73 moderators: Array<CommunityUser>;
74 admins: Array<UserView>;
75 // TODO is this necessary, can't I get it from the node itself?
76 postCreatorId?: number;
77 showCommunity?: boolean;
78 sort?: CommentSortType;
80 enableDownvotes: boolean;
83 export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
84 private emptyState: CommentNodeState = {
87 showRemoveDialog: false,
92 banType: BanType.Community,
96 showConfirmTransferSite: false,
97 showConfirmTransferCommunity: false,
98 showConfirmAppointAsMod: false,
99 showConfirmAppointAsAdmin: false,
100 my_vote: this.props.node.comment.my_vote,
101 score: this.props.node.comment.score,
102 upvotes: this.props.node.comment.upvotes,
103 downvotes: this.props.node.comment.downvotes,
104 borderColor: this.props.node.comment.depth
105 ? colorList[this.props.node.comment.depth % colorList.length]
111 constructor(props: any, context: any) {
112 super(props, context);
114 this.state = this.emptyState;
115 this.handleReplyCancel = this.handleReplyCancel.bind(this);
116 this.handleCommentUpvote = this.handleCommentUpvote.bind(this);
117 this.handleCommentDownvote = this.handleCommentDownvote.bind(this);
120 componentWillReceiveProps(nextProps: CommentNodeProps) {
121 this.state.my_vote = nextProps.node.comment.my_vote;
122 this.state.upvotes = nextProps.node.comment.upvotes;
123 this.state.downvotes = nextProps.node.comment.downvotes;
124 this.state.score = nextProps.node.comment.score;
125 this.state.readLoading = false;
126 this.state.saveLoading = false;
127 this.setState(this.state);
131 let node = this.props.node;
134 className={`comment ${
135 node.comment.parent_id && !this.props.noIndent ? 'ml-1' : ''
139 id={`comment-${node.comment.id}`}
140 className={`details comment-node py-2 ${
141 !this.props.noBorder ? 'border-top border-light' : ''
142 } ${this.isCommentNew ? 'mark' : ''}`}
144 !this.props.noIndent &&
145 this.props.node.comment.parent_id &&
146 `border-left: 2px ${this.state.borderColor} solid !important`
151 !this.props.noIndent &&
152 this.props.node.comment.parent_id &&
156 <div class="d-flex flex-wrap align-items-center text-muted small">
160 name: node.comment.creator_name,
161 preferred_username: node.comment.creator_preferred_username,
162 avatar: node.comment.creator_avatar,
163 id: node.comment.creator_id,
164 local: node.comment.creator_local,
165 actor_id: node.comment.creator_actor_id,
166 published: node.comment.creator_published,
172 <div className="badge badge-light d-none d-sm-inline mr-2">
177 <div className="badge badge-light d-none d-sm-inline mr-2">
181 {this.isPostCreator && (
182 <div className="badge badge-light d-none d-sm-inline mr-2">
186 {(node.comment.banned_from_community || node.comment.banned) && (
187 <div className="badge badge-danger mr-2">
191 {this.props.showCommunity && (
193 <span class="mx-1">{i18n.t('to')}</span>
196 name: node.comment.community_name,
197 id: node.comment.community_id,
198 local: node.comment.community_local,
199 actor_id: node.comment.community_actor_id,
200 icon: node.comment.community_icon,
203 <span class="mx-2">•</span>
204 <Link class="mr-2" to={`/post/${node.comment.post_id}`}>
205 {node.comment.post_name}
210 class="btn text-muted"
211 onClick={linkEvent(this, this.handleCommentCollapse)}
213 {this.state.collapsed ? (
214 <svg class="icon icon-inline">
215 <use xlinkHref="#icon-plus-square"></use>
218 <svg class="icon icon-inline">
219 <use xlinkHref="#icon-minus-square"></use>
223 {/* This is an expanding spacer for mobile */}
224 <div className="mr-lg-4 flex-grow-1 flex-lg-grow-0 unselectable pointer mx-2"></div>
226 className={`btn p-0 unselectable pointer ${this.scoreColor}`}
227 onClick={linkEvent(node, this.handleCommentUpvote)}
228 data-tippy-content={this.pointsTippy}
230 <svg class="icon icon-inline mr-1">
231 <use xlinkHref="#icon-zap"></use>
233 <span class="mr-1">{this.state.score}</span>
235 <span className="mr-1">•</span>
237 <MomentTime data={node.comment} />
240 {/* end of user row */}
241 {this.state.showEdit && (
245 onReplyCancel={this.handleReplyCancel}
246 disabled={this.props.locked}
250 {!this.state.showEdit && !this.state.collapsed && (
252 {this.state.viewSource ? (
253 <pre>{this.commentUnlessRemoved}</pre>
257 dangerouslySetInnerHTML={mdToHtml(
258 this.commentUnlessRemoved
262 <div class="d-flex justify-content-between justify-content-lg-start flex-wrap text-muted font-weight-bold">
263 {this.props.showContext && this.linkBtn}
264 {this.props.markable && (
266 class="btn btn-link btn-animate text-muted"
267 onClick={linkEvent(this, this.handleMarkRead)}
270 ? i18n.t('mark_as_unread')
271 : i18n.t('mark_as_read')
274 {this.state.readLoading ? (
278 class={`icon icon-inline ${
279 node.comment.read && 'text-success'
282 <use xlinkHref="#icon-check"></use>
287 {UserService.Instance.user && !this.props.viewOnly && (
290 className={`btn btn-link btn-animate ${
291 this.state.my_vote == 1 ? 'text-info' : 'text-muted'
293 onClick={linkEvent(node, this.handleCommentUpvote)}
294 data-tippy-content={i18n.t('upvote')}
296 <svg class="icon icon-inline">
297 <use xlinkHref="#icon-arrow-up"></use>
299 {this.state.upvotes !== this.state.score && (
300 <span class="ml-1">{this.state.upvotes}</span>
303 {this.props.enableDownvotes && (
305 className={`btn btn-link btn-animate ${
306 this.state.my_vote == -1
310 onClick={linkEvent(node, this.handleCommentDownvote)}
311 data-tippy-content={i18n.t('downvote')}
313 <svg class="icon icon-inline">
314 <use xlinkHref="#icon-arrow-down"></use>
316 {this.state.upvotes !== this.state.score && (
317 <span class="ml-1">{this.state.downvotes}</span>
322 class="btn btn-link btn-animate text-muted"
323 onClick={linkEvent(this, this.handleReplyClick)}
324 data-tippy-content={i18n.t('reply')}
326 <svg class="icon icon-inline">
327 <use xlinkHref="#icon-reply1"></use>
330 {!this.state.showAdvanced ? (
332 className="btn btn-link btn-animate text-muted"
333 onClick={linkEvent(this, this.handleShowAdvanced)}
334 data-tippy-content={i18n.t('more')}
336 <svg class="icon icon-inline">
337 <use xlinkHref="#icon-more-vertical"></use>
342 {!this.myComment && (
343 <button class="btn btn-link btn-animate">
346 to={`/create_private_message?recipient_id=${node.comment.creator_id}`}
347 title={i18n.t('message').toLowerCase()}
350 <use xlinkHref="#icon-mail"></use>
355 {!this.props.showContext && this.linkBtn}
357 class="btn btn-link btn-animate text-muted"
360 this.handleSaveCommentClick
368 {this.state.saveLoading ? (
372 class={`icon icon-inline ${
373 node.comment.saved && 'text-warning'
376 <use xlinkHref="#icon-star"></use>
381 className="btn btn-link btn-animate text-muted"
382 onClick={linkEvent(this, this.handleViewSource)}
383 data-tippy-content={i18n.t('view_source')}
386 class={`icon icon-inline ${
387 this.state.viewSource && 'text-success'
390 <use xlinkHref="#icon-file-text"></use>
396 class="btn btn-link btn-animate text-muted"
397 onClick={linkEvent(this, this.handleEditClick)}
398 data-tippy-content={i18n.t('edit')}
400 <svg class="icon icon-inline">
401 <use xlinkHref="#icon-edit"></use>
405 class="btn btn-link btn-animate text-muted"
408 this.handleDeleteClick
411 !node.comment.deleted
417 class={`icon icon-inline ${
418 node.comment.deleted && 'text-danger'
421 <use xlinkHref="#icon-trash"></use>
426 {/* Admins and mods can remove comments */}
427 {(this.canMod || this.canAdmin) && (
429 {!node.comment.removed ? (
431 class="btn btn-link btn-animate text-muted"
434 this.handleModRemoveShow
441 class="btn btn-link btn-animate text-muted"
444 this.handleModRemoveSubmit
452 {/* Mods can ban from community, and appoint as mods to community */}
456 (!node.comment.banned_from_community ? (
458 class="btn btn-link btn-animate text-muted"
461 this.handleModBanFromCommunityShow
468 class="btn btn-link btn-animate text-muted"
471 this.handleModBanFromCommunitySubmit
477 {!node.comment.banned_from_community &&
478 (!this.state.showConfirmAppointAsMod ? (
480 class="btn btn-link btn-animate text-muted"
483 this.handleShowConfirmAppointAsMod
487 ? i18n.t('remove_as_mod')
488 : i18n.t('appoint_as_mod')}
492 <button class="btn btn-link btn-animate text-muted">
493 {i18n.t('are_you_sure')}
496 class="btn btn-link btn-animate text-muted"
499 this.handleAddModToCommunity
505 class="btn btn-link btn-animate text-muted"
508 this.handleCancelConfirmAppointAsMod
517 {/* Community creators and admins can transfer community to another mod */}
518 {(this.amCommunityCreator || this.canAdmin) &&
520 (!this.state.showConfirmTransferCommunity ? (
522 class="btn btn-link btn-animate text-muted"
525 this.handleShowConfirmTransferCommunity
528 {i18n.t('transfer_community')}
532 <button class="btn btn-link btn-animate text-muted">
533 {i18n.t('are_you_sure')}
536 class="btn btn-link btn-animate text-muted"
539 this.handleTransferCommunity
545 class="btn btn-link btn-animate text-muted"
549 .handleCancelShowConfirmTransferCommunity
556 {/* Admins can ban from all, and appoint other admins */}
560 (!node.comment.banned ? (
562 class="btn btn-link btn-animate text-muted"
565 this.handleModBanShow
568 {i18n.t('ban_from_site')}
572 class="btn btn-link btn-animate text-muted"
575 this.handleModBanSubmit
578 {i18n.t('unban_from_site')}
581 {!node.comment.banned &&
582 (!this.state.showConfirmAppointAsAdmin ? (
584 class="btn btn-link btn-animate text-muted"
587 this.handleShowConfirmAppointAsAdmin
591 ? i18n.t('remove_as_admin')
592 : i18n.t('appoint_as_admin')}
596 <button class="btn btn-link btn-animate text-muted">
597 {i18n.t('are_you_sure')}
600 class="btn btn-link btn-animate text-muted"
609 class="btn btn-link btn-animate text-muted"
612 this.handleCancelConfirmAppointAsAdmin
621 {/* Site Creator can transfer to another admin */}
622 {this.amSiteCreator &&
624 (!this.state.showConfirmTransferSite ? (
626 class="btn btn-link btn-animate text-muted"
629 this.handleShowConfirmTransferSite
632 {i18n.t('transfer_site')}
636 <button class="btn btn-link btn-animate text-muted">
637 {i18n.t('are_you_sure')}
640 class="btn btn-link btn-animate text-muted"
643 this.handleTransferSite
649 class="btn btn-link btn-animate text-muted"
652 this.handleCancelShowConfirmTransferSite
664 {/* end of button group */}
669 {/* end of details */}
670 {this.state.showRemoveDialog && (
673 onSubmit={linkEvent(this, this.handleModRemoveSubmit)}
677 class="form-control mr-2"
678 placeholder={i18n.t('reason')}
679 value={this.state.removeReason}
680 onInput={linkEvent(this, this.handleModRemoveReasonChange)}
682 <button type="submit" class="btn btn-secondary">
683 {i18n.t('remove_comment')}
687 {this.state.showBanDialog && (
688 <form onSubmit={linkEvent(this, this.handleModBanBothSubmit)}>
689 <div class="form-group row">
690 <label class="col-form-label">{i18n.t('reason')}</label>
693 class="form-control mr-2"
694 placeholder={i18n.t('reason')}
695 value={this.state.banReason}
696 onInput={linkEvent(this, this.handleModBanReasonChange)}
699 {/* TODO hold off on expires until later */}
700 {/* <div class="form-group row"> */}
701 {/* <label class="col-form-label">Expires</label> */}
702 {/* <input type="date" class="form-control mr-2" placeholder={i18n.t('expires')} value={this.state.banExpires} onInput={linkEvent(this, this.handleModBanExpiresChange)} /> */}
704 <div class="form-group row">
705 <button type="submit" class="btn btn-secondary">
706 {i18n.t('ban')} {node.comment.creator_name}
711 {this.state.showReply && (
714 onReplyCancel={this.handleReplyCancel}
715 disabled={this.props.locked}
719 {node.children && !this.state.collapsed && (
721 nodes={node.children}
722 locked={this.props.locked}
723 moderators={this.props.moderators}
724 admins={this.props.admins}
725 postCreatorId={this.props.postCreatorId}
726 sort={this.props.sort}
727 sortType={this.props.sortType}
728 enableDownvotes={this.props.enableDownvotes}
731 {/* A collapsed clearfix */}
732 {this.state.collapsed && <div class="row col-12"></div>}
738 let node = this.props.node;
741 class="btn btn-link btn-animate text-muted"
742 to={`/post/${node.comment.post_id}/comment/${node.comment.id}`}
743 title={this.props.showContext ? i18n.t('show_context') : i18n.t('link')}
745 <svg class="icon icon-inline">
746 <use xlinkHref="#icon-link"></use>
754 <svg class="icon icon-spinner spin">
755 <use xlinkHref="#icon-spinner"></use>
760 get myComment(): boolean {
762 UserService.Instance.user &&
763 this.props.node.comment.creator_id == UserService.Instance.user.id
767 get isMod(): boolean {
769 this.props.moderators &&
771 this.props.moderators.map(m => m.user_id),
772 this.props.node.comment.creator_id
777 get isAdmin(): boolean {
781 this.props.admins.map(a => a.id),
782 this.props.node.comment.creator_id
787 get isPostCreator(): boolean {
788 return this.props.node.comment.creator_id == this.props.postCreatorId;
791 get canMod(): boolean {
792 if (this.props.admins && this.props.moderators) {
793 let adminsThenMods = this.props.admins
795 .concat(this.props.moderators.map(m => m.user_id));
798 UserService.Instance.user,
800 this.props.node.comment.creator_id
807 get canAdmin(): boolean {
811 UserService.Instance.user,
812 this.props.admins.map(a => a.id),
813 this.props.node.comment.creator_id
818 get amCommunityCreator(): boolean {
820 this.props.moderators &&
821 UserService.Instance.user &&
822 this.props.node.comment.creator_id != UserService.Instance.user.id &&
823 UserService.Instance.user.id == this.props.moderators[0].user_id
827 get amSiteCreator(): boolean {
830 UserService.Instance.user &&
831 this.props.node.comment.creator_id != UserService.Instance.user.id &&
832 UserService.Instance.user.id == this.props.admins[0].id
836 get commentUnlessRemoved(): string {
837 let node = this.props.node;
838 return node.comment.removed
839 ? `*${i18n.t('removed')}*`
840 : node.comment.deleted
841 ? `*${i18n.t('deleted')}*`
842 : node.comment.content;
845 handleReplyClick(i: CommentNode) {
846 i.state.showReply = true;
850 handleEditClick(i: CommentNode) {
851 i.state.showEdit = true;
855 handleDeleteClick(i: CommentNode) {
856 let deleteForm: DeleteCommentForm = {
857 edit_id: i.props.node.comment.id,
858 deleted: !i.props.node.comment.deleted,
861 WebSocketService.Instance.deleteComment(deleteForm);
864 handleSaveCommentClick(i: CommentNode) {
866 i.props.node.comment.saved == undefined
868 : !i.props.node.comment.saved;
869 let form: SaveCommentForm = {
870 comment_id: i.props.node.comment.id,
874 WebSocketService.Instance.saveComment(form);
876 i.state.saveLoading = true;
877 i.setState(this.state);
880 handleReplyCancel() {
881 this.state.showReply = false;
882 this.state.showEdit = false;
883 this.setState(this.state);
886 handleCommentUpvote(i: CommentNodeI) {
887 let new_vote = this.state.my_vote == 1 ? 0 : 1;
889 if (this.state.my_vote == 1) {
891 this.state.upvotes--;
892 } else if (this.state.my_vote == -1) {
893 this.state.downvotes--;
894 this.state.upvotes++;
895 this.state.score += 2;
897 this.state.upvotes++;
901 this.state.my_vote = new_vote;
903 let form: CommentLikeForm = {
904 comment_id: i.comment.id,
905 score: this.state.my_vote,
908 WebSocketService.Instance.likeComment(form);
909 this.setState(this.state);
913 handleCommentDownvote(i: CommentNodeI) {
914 let new_vote = this.state.my_vote == -1 ? 0 : -1;
916 if (this.state.my_vote == 1) {
917 this.state.score -= 2;
918 this.state.upvotes--;
919 this.state.downvotes++;
920 } else if (this.state.my_vote == -1) {
921 this.state.downvotes--;
924 this.state.downvotes++;
928 this.state.my_vote = new_vote;
930 let form: CommentLikeForm = {
931 comment_id: i.comment.id,
932 score: this.state.my_vote,
935 WebSocketService.Instance.likeComment(form);
936 this.setState(this.state);
940 handleModRemoveShow(i: CommentNode) {
941 i.state.showRemoveDialog = true;
945 handleModRemoveReasonChange(i: CommentNode, event: any) {
946 i.state.removeReason = event.target.value;
950 handleModRemoveSubmit(i: CommentNode) {
951 event.preventDefault();
952 let form: RemoveCommentForm = {
953 edit_id: i.props.node.comment.id,
954 removed: !i.props.node.comment.removed,
955 reason: i.state.removeReason,
958 WebSocketService.Instance.removeComment(form);
960 i.state.showRemoveDialog = false;
964 handleMarkRead(i: CommentNode) {
965 // if it has a user_mention_id field, then its a mention
966 if (i.props.node.comment.user_mention_id) {
967 let form: MarkUserMentionAsReadForm = {
968 user_mention_id: i.props.node.comment.user_mention_id,
969 read: !i.props.node.comment.read,
971 WebSocketService.Instance.markUserMentionAsRead(form);
973 let form: MarkCommentAsReadForm = {
974 edit_id: i.props.node.comment.id,
975 read: !i.props.node.comment.read,
978 WebSocketService.Instance.markCommentAsRead(form);
981 i.state.readLoading = true;
982 i.setState(this.state);
985 handleModBanFromCommunityShow(i: CommentNode) {
986 i.state.showBanDialog = !i.state.showBanDialog;
987 i.state.banType = BanType.Community;
991 handleModBanShow(i: CommentNode) {
992 i.state.showBanDialog = !i.state.showBanDialog;
993 i.state.banType = BanType.Site;
997 handleModBanReasonChange(i: CommentNode, event: any) {
998 i.state.banReason = event.target.value;
1002 handleModBanExpiresChange(i: CommentNode, event: any) {
1003 i.state.banExpires = event.target.value;
1004 i.setState(i.state);
1007 handleModBanFromCommunitySubmit(i: CommentNode) {
1008 i.state.banType = BanType.Community;
1009 i.setState(i.state);
1010 i.handleModBanBothSubmit(i);
1013 handleModBanSubmit(i: CommentNode) {
1014 i.state.banType = BanType.Site;
1015 i.setState(i.state);
1016 i.handleModBanBothSubmit(i);
1019 handleModBanBothSubmit(i: CommentNode) {
1020 event.preventDefault();
1022 if (i.state.banType == BanType.Community) {
1023 let form: BanFromCommunityForm = {
1024 user_id: i.props.node.comment.creator_id,
1025 community_id: i.props.node.comment.community_id,
1026 ban: !i.props.node.comment.banned_from_community,
1027 reason: i.state.banReason,
1028 expires: getUnixTime(i.state.banExpires),
1030 WebSocketService.Instance.banFromCommunity(form);
1032 let form: BanUserForm = {
1033 user_id: i.props.node.comment.creator_id,
1034 ban: !i.props.node.comment.banned,
1035 reason: i.state.banReason,
1036 expires: getUnixTime(i.state.banExpires),
1038 WebSocketService.Instance.banUser(form);
1041 i.state.showBanDialog = false;
1042 i.setState(i.state);
1045 handleShowConfirmAppointAsMod(i: CommentNode) {
1046 i.state.showConfirmAppointAsMod = true;
1047 i.setState(i.state);
1050 handleCancelConfirmAppointAsMod(i: CommentNode) {
1051 i.state.showConfirmAppointAsMod = false;
1052 i.setState(i.state);
1055 handleAddModToCommunity(i: CommentNode) {
1056 let form: AddModToCommunityForm = {
1057 user_id: i.props.node.comment.creator_id,
1058 community_id: i.props.node.comment.community_id,
1061 WebSocketService.Instance.addModToCommunity(form);
1062 i.state.showConfirmAppointAsMod = false;
1063 i.setState(i.state);
1066 handleShowConfirmAppointAsAdmin(i: CommentNode) {
1067 i.state.showConfirmAppointAsAdmin = true;
1068 i.setState(i.state);
1071 handleCancelConfirmAppointAsAdmin(i: CommentNode) {
1072 i.state.showConfirmAppointAsAdmin = false;
1073 i.setState(i.state);
1076 handleAddAdmin(i: CommentNode) {
1077 let form: AddAdminForm = {
1078 user_id: i.props.node.comment.creator_id,
1081 WebSocketService.Instance.addAdmin(form);
1082 i.state.showConfirmAppointAsAdmin = false;
1083 i.setState(i.state);
1086 handleShowConfirmTransferCommunity(i: CommentNode) {
1087 i.state.showConfirmTransferCommunity = true;
1088 i.setState(i.state);
1091 handleCancelShowConfirmTransferCommunity(i: CommentNode) {
1092 i.state.showConfirmTransferCommunity = false;
1093 i.setState(i.state);
1096 handleTransferCommunity(i: CommentNode) {
1097 let form: TransferCommunityForm = {
1098 community_id: i.props.node.comment.community_id,
1099 user_id: i.props.node.comment.creator_id,
1101 WebSocketService.Instance.transferCommunity(form);
1102 i.state.showConfirmTransferCommunity = false;
1103 i.setState(i.state);
1106 handleShowConfirmTransferSite(i: CommentNode) {
1107 i.state.showConfirmTransferSite = true;
1108 i.setState(i.state);
1111 handleCancelShowConfirmTransferSite(i: CommentNode) {
1112 i.state.showConfirmTransferSite = false;
1113 i.setState(i.state);
1116 handleTransferSite(i: CommentNode) {
1117 let form: TransferSiteForm = {
1118 user_id: i.props.node.comment.creator_id,
1120 WebSocketService.Instance.transferSite(form);
1121 i.state.showConfirmTransferSite = false;
1122 i.setState(i.state);
1125 get isCommentNew(): boolean {
1126 let now = moment.utc().subtract(10, 'minutes');
1127 let then = moment.utc(this.props.node.comment.published);
1128 return now.isBefore(then);
1131 handleCommentCollapse(i: CommentNode) {
1132 i.state.collapsed = !i.state.collapsed;
1133 i.setState(i.state);
1136 handleViewSource(i: CommentNode) {
1137 i.state.viewSource = !i.state.viewSource;
1138 i.setState(i.state);
1141 handleShowAdvanced(i: CommentNode) {
1142 i.state.showAdvanced = !i.state.showAdvanced;
1143 i.setState(i.state);
1148 if (this.state.my_vote == 1) {
1150 } else if (this.state.my_vote == -1) {
1151 return 'text-danger';
1153 return 'text-muted';
1157 get pointsTippy(): string {
1158 let points = i18n.t('number_of_points', {
1159 count: this.state.score,
1162 let upvotes = i18n.t('number_of_upvotes', {
1163 count: this.state.upvotes,
1166 let downvotes = i18n.t('number_of_downvotes', {
1167 count: this.state.downvotes,
1170 return `${points} • ${upvotes} • ${downvotes}`;