1 import { Component, linkEvent } from 'inferno';
2 import { Link } from 'inferno-router';
4 CommentNode as CommentNodeI,
6 CommentForm as CommentFormI,
13 AddModToCommunityForm,
15 TransferCommunityForm,
20 } from '../interfaces';
21 import { WebSocketService, UserService } from '../services';
30 import moment from 'moment';
31 import { MomentTime } from './moment-time';
32 import { CommentForm } from './comment-form';
33 import { CommentNodes } from './comment-nodes';
34 import { UserListing } from './user-listing';
35 import { i18n } from '../i18next';
37 interface CommentNodeState {
40 showRemoveDialog: boolean;
42 showBanDialog: boolean;
46 showConfirmTransferSite: boolean;
47 showConfirmTransferCommunity: boolean;
48 showConfirmAppointAsMod: boolean;
49 showConfirmAppointAsAdmin: boolean;
52 showAdvanced: boolean;
62 interface CommentNodeProps {
68 showContext?: boolean;
69 moderators: Array<CommunityUser>;
70 admins: Array<UserView>;
71 // TODO is this necessary, can't I get it from the node itself?
72 postCreatorId?: number;
73 showCommunity?: boolean;
74 sort?: CommentSortType;
78 export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
79 private emptyState: CommentNodeState = {
82 showRemoveDialog: false,
87 banType: BanType.Community,
91 showConfirmTransferSite: false,
92 showConfirmTransferCommunity: false,
93 showConfirmAppointAsMod: false,
94 showConfirmAppointAsAdmin: false,
95 my_vote: this.props.node.comment.my_vote,
96 score: this.props.node.comment.score,
97 upvotes: this.props.node.comment.upvotes,
98 downvotes: this.props.node.comment.downvotes,
99 borderColor: this.props.node.comment.depth
100 ? colorList[this.props.node.comment.depth % colorList.length]
106 constructor(props: any, context: any) {
107 super(props, context);
109 this.state = this.emptyState;
110 this.handleReplyCancel = this.handleReplyCancel.bind(this);
111 this.handleCommentUpvote = this.handleCommentUpvote.bind(this);
112 this.handleCommentDownvote = this.handleCommentDownvote.bind(this);
115 componentWillReceiveProps(nextProps: CommentNodeProps) {
116 this.state.my_vote = nextProps.node.comment.my_vote;
117 this.state.upvotes = nextProps.node.comment.upvotes;
118 this.state.downvotes = nextProps.node.comment.downvotes;
119 this.state.score = nextProps.node.comment.score;
120 this.state.readLoading = false;
121 this.state.saveLoading = false;
122 this.setState(this.state);
126 let node = this.props.node;
129 className={`comment ${
130 node.comment.parent_id && !this.props.noIndent ? 'ml-1' : ''
134 id={`comment-${node.comment.id}`}
135 className={`details comment-node border-top border-light py-2 ${
136 this.isCommentNew ? 'mark' : ''
139 !this.props.noIndent &&
140 this.props.node.comment.parent_id &&
141 `border-left: 2px ${this.state.borderColor} solid !important`
146 !this.props.noIndent &&
147 this.props.node.comment.parent_id &&
151 <div class="d-flex flex-wrap align-items-center text-muted small">
155 name: node.comment.creator_name,
156 avatar: node.comment.creator_avatar,
157 id: node.comment.creator_id,
158 local: node.comment.creator_local,
159 actor_id: node.comment.creator_actor_id,
164 <div className="badge badge-light d-none d-sm-inline mr-2">
169 <div className="badge badge-light d-none d-sm-inline mr-2">
173 {this.isPostCreator && (
174 <div className="badge badge-light d-none d-sm-inline mr-2">
178 {(node.comment.banned_from_community || node.comment.banned) && (
179 <div className="badge badge-danger mr-2">
183 {this.props.showCommunity && (
185 <span class="mx-1">{i18n.t('to')}</span>
186 <Link class="mr-2" to={`/c/${node.comment.community_name}`}>
187 {node.comment.community_name}
192 className="mr-lg-4 flex-grow-1 flex-lg-grow-0 unselectable pointer mx-2"
193 onClick={linkEvent(this, this.handleCommentCollapse)}
195 {this.state.collapsed ? (
196 <svg class="icon icon-inline">
197 <use xlinkHref="#icon-plus-square"></use>
200 <svg class="icon icon-inline">
201 <use xlinkHref="#icon-minus-square"></use>
206 className={`unselectable pointer ${this.scoreColor}`}
207 onClick={linkEvent(node, this.handleCommentUpvote)}
208 data-tippy-content={this.pointsTippy}
210 <svg class="icon icon-inline mr-1">
211 <use xlinkHref="#icon-zap"></use>
213 <span class="mr-1">{this.state.score}</span>
215 <span className="mr-1">•</span>
217 <MomentTime data={node.comment} />
220 {/* end of user row */}
221 {this.state.showEdit && (
225 onReplyCancel={this.handleReplyCancel}
226 disabled={this.props.locked}
229 {!this.state.showEdit && !this.state.collapsed && (
231 {this.state.viewSource ? (
232 <pre>{this.commentUnlessRemoved}</pre>
236 dangerouslySetInnerHTML={mdToHtml(
237 this.commentUnlessRemoved
241 <div class="d-flex justify-content-between justify-content-lg-start flex-wrap text-muted font-weight-bold">
242 {this.props.showContext && this.linkBtn}
243 {this.props.markable && (
245 class="btn btn-link btn-animate text-muted"
246 onClick={linkEvent(this, this.handleMarkRead)}
249 ? i18n.t('mark_as_unread')
250 : i18n.t('mark_as_read')
253 {this.state.readLoading ? (
257 class={`icon icon-inline ${
258 node.comment.read && 'text-success'
261 <use xlinkHref="#icon-check"></use>
266 {UserService.Instance.user && !this.props.viewOnly && (
269 className={`btn btn-link btn-animate ${
270 this.state.my_vote == 1 ? 'text-info' : 'text-muted'
272 onClick={linkEvent(node, this.handleCommentUpvote)}
273 data-tippy-content={i18n.t('upvote')}
275 <svg class="icon icon-inline">
276 <use xlinkHref="#icon-arrow-up"></use>
278 {this.state.upvotes !== this.state.score && (
279 <span class="ml-1">{this.state.upvotes}</span>
282 {WebSocketService.Instance.site.enable_downvotes && (
284 className={`btn btn-link btn-animate ${
285 this.state.my_vote == -1
289 onClick={linkEvent(node, this.handleCommentDownvote)}
290 data-tippy-content={i18n.t('downvote')}
292 <svg class="icon icon-inline">
293 <use xlinkHref="#icon-arrow-down"></use>
295 {this.state.upvotes !== this.state.score && (
296 <span class="ml-1">{this.state.downvotes}</span>
301 class="btn btn-link btn-animate text-muted"
302 onClick={linkEvent(this, this.handleReplyClick)}
303 data-tippy-content={i18n.t('reply')}
305 <svg class="icon icon-inline">
306 <use xlinkHref="#icon-reply1"></use>
309 {!this.state.showAdvanced ? (
311 className="btn btn-link btn-animate text-muted"
312 onClick={linkEvent(this, this.handleShowAdvanced)}
313 data-tippy-content={i18n.t('more')}
315 <svg class="icon icon-inline">
316 <use xlinkHref="#icon-more-vertical"></use>
321 {!this.myComment && (
322 <button class="btn btn-link btn-animate">
325 to={`/create_private_message?recipient_id=${node.comment.creator_id}`}
326 title={i18n.t('message').toLowerCase()}
329 <use xlinkHref="#icon-mail"></use>
334 {!this.props.showContext && this.linkBtn}
336 class="btn btn-link btn-animate text-muted"
339 this.handleSaveCommentClick
347 {this.state.saveLoading ? (
351 class={`icon icon-inline ${
352 node.comment.saved && 'text-warning'
355 <use xlinkHref="#icon-star"></use>
360 className="btn btn-link btn-animate text-muted"
361 onClick={linkEvent(this, this.handleViewSource)}
362 data-tippy-content={i18n.t('view_source')}
365 class={`icon icon-inline ${
366 this.state.viewSource && 'text-success'
369 <use xlinkHref="#icon-file-text"></use>
375 class="btn btn-link btn-animate text-muted"
376 onClick={linkEvent(this, this.handleEditClick)}
377 data-tippy-content={i18n.t('edit')}
379 <svg class="icon icon-inline">
380 <use xlinkHref="#icon-edit"></use>
384 class="btn btn-link btn-animate text-muted"
387 this.handleDeleteClick
390 !node.comment.deleted
396 class={`icon icon-inline ${
397 node.comment.deleted && 'text-danger'
400 <use xlinkHref="#icon-trash"></use>
405 {/* Admins and mods can remove comments */}
406 {(this.canMod || this.canAdmin) && (
408 {!node.comment.removed ? (
410 class="btn btn-link btn-animate text-muted"
413 this.handleModRemoveShow
420 class="btn btn-link btn-animate text-muted"
423 this.handleModRemoveSubmit
431 {/* Mods can ban from community, and appoint as mods to community */}
435 (!node.comment.banned_from_community ? (
437 class="btn btn-link btn-animate text-muted"
440 this.handleModBanFromCommunityShow
447 class="btn btn-link btn-animate text-muted"
450 this.handleModBanFromCommunitySubmit
456 {!node.comment.banned_from_community &&
457 (!this.state.showConfirmAppointAsMod ? (
459 class="btn btn-link btn-animate text-muted"
462 this.handleShowConfirmAppointAsMod
466 ? i18n.t('remove_as_mod')
467 : i18n.t('appoint_as_mod')}
471 <button class="btn btn-link btn-animate text-muted">
472 {i18n.t('are_you_sure')}
475 class="btn btn-link btn-animate text-muted"
478 this.handleAddModToCommunity
484 class="btn btn-link btn-animate text-muted"
487 this.handleCancelConfirmAppointAsMod
496 {/* Community creators and admins can transfer community to another mod */}
497 {(this.amCommunityCreator || this.canAdmin) &&
499 (!this.state.showConfirmTransferCommunity ? (
501 class="btn btn-link btn-animate text-muted"
504 this.handleShowConfirmTransferCommunity
507 {i18n.t('transfer_community')}
511 <button class="btn btn-link btn-animate text-muted">
512 {i18n.t('are_you_sure')}
515 class="btn btn-link btn-animate text-muted"
518 this.handleTransferCommunity
524 class="btn btn-link btn-animate text-muted"
528 .handleCancelShowConfirmTransferCommunity
535 {/* Admins can ban from all, and appoint other admins */}
539 (!node.comment.banned ? (
541 class="btn btn-link btn-animate text-muted"
544 this.handleModBanShow
547 {i18n.t('ban_from_site')}
551 class="btn btn-link btn-animate text-muted"
554 this.handleModBanSubmit
557 {i18n.t('unban_from_site')}
560 {!node.comment.banned &&
561 (!this.state.showConfirmAppointAsAdmin ? (
563 class="btn btn-link btn-animate text-muted"
566 this.handleShowConfirmAppointAsAdmin
570 ? i18n.t('remove_as_admin')
571 : i18n.t('appoint_as_admin')}
575 <button class="btn btn-link btn-animate text-muted">
576 {i18n.t('are_you_sure')}
579 class="btn btn-link btn-animate text-muted"
588 class="btn btn-link btn-animate text-muted"
591 this.handleCancelConfirmAppointAsAdmin
600 {/* Site Creator can transfer to another admin */}
601 {this.amSiteCreator &&
603 (!this.state.showConfirmTransferSite ? (
605 class="btn btn-link btn-animate text-muted"
608 this.handleShowConfirmTransferSite
611 {i18n.t('transfer_site')}
615 <button class="btn btn-link btn-animate text-muted">
616 {i18n.t('are_you_sure')}
619 class="btn btn-link btn-animate text-muted"
622 this.handleTransferSite
628 class="btn btn-link btn-animate text-muted"
631 this.handleCancelShowConfirmTransferSite
643 {/* end of button group */}
648 {/* end of details */}
649 {this.state.showRemoveDialog && (
652 onSubmit={linkEvent(this, this.handleModRemoveSubmit)}
656 class="form-control mr-2"
657 placeholder={i18n.t('reason')}
658 value={this.state.removeReason}
659 onInput={linkEvent(this, this.handleModRemoveReasonChange)}
661 <button type="submit" class="btn btn-secondary">
662 {i18n.t('remove_comment')}
666 {this.state.showBanDialog && (
667 <form onSubmit={linkEvent(this, this.handleModBanBothSubmit)}>
668 <div class="form-group row">
669 <label class="col-form-label">{i18n.t('reason')}</label>
672 class="form-control mr-2"
673 placeholder={i18n.t('reason')}
674 value={this.state.banReason}
675 onInput={linkEvent(this, this.handleModBanReasonChange)}
678 {/* TODO hold off on expires until later */}
679 {/* <div class="form-group row"> */}
680 {/* <label class="col-form-label">Expires</label> */}
681 {/* <input type="date" class="form-control mr-2" placeholder={i18n.t('expires')} value={this.state.banExpires} onInput={linkEvent(this, this.handleModBanExpiresChange)} /> */}
683 <div class="form-group row">
684 <button type="submit" class="btn btn-secondary">
685 {i18n.t('ban')} {node.comment.creator_name}
690 {this.state.showReply && (
693 onReplyCancel={this.handleReplyCancel}
694 disabled={this.props.locked}
697 {node.children && !this.state.collapsed && (
699 nodes={node.children}
700 locked={this.props.locked}
701 moderators={this.props.moderators}
702 admins={this.props.admins}
703 postCreatorId={this.props.postCreatorId}
704 sort={this.props.sort}
705 sortType={this.props.sortType}
708 {/* A collapsed clearfix */}
709 {this.state.collapsed && <div class="row col-12"></div>}
715 let node = this.props.node;
718 class="btn btn-link btn-animate text-muted"
719 to={`/post/${node.comment.post_id}/comment/${node.comment.id}`}
720 title={this.props.showContext ? i18n.t('show_context') : i18n.t('link')}
722 <svg class="icon icon-inline">
723 <use xlinkHref="#icon-link"></use>
731 <svg class="icon icon-spinner spin">
732 <use xlinkHref="#icon-spinner"></use>
737 get myComment(): boolean {
739 UserService.Instance.user &&
740 this.props.node.comment.creator_id == UserService.Instance.user.id
744 get isMod(): boolean {
746 this.props.moderators &&
748 this.props.moderators.map(m => m.user_id),
749 this.props.node.comment.creator_id
754 get isAdmin(): boolean {
758 this.props.admins.map(a => a.id),
759 this.props.node.comment.creator_id
764 get isPostCreator(): boolean {
765 return this.props.node.comment.creator_id == this.props.postCreatorId;
768 get canMod(): boolean {
769 if (this.props.admins && this.props.moderators) {
770 let adminsThenMods = this.props.admins
772 .concat(this.props.moderators.map(m => m.user_id));
775 UserService.Instance.user,
777 this.props.node.comment.creator_id
784 get canAdmin(): boolean {
788 UserService.Instance.user,
789 this.props.admins.map(a => a.id),
790 this.props.node.comment.creator_id
795 get amCommunityCreator(): boolean {
797 this.props.moderators &&
798 UserService.Instance.user &&
799 this.props.node.comment.creator_id != UserService.Instance.user.id &&
800 UserService.Instance.user.id == this.props.moderators[0].user_id
804 get amSiteCreator(): boolean {
807 UserService.Instance.user &&
808 this.props.node.comment.creator_id != UserService.Instance.user.id &&
809 UserService.Instance.user.id == this.props.admins[0].id
813 get commentUnlessRemoved(): string {
814 let node = this.props.node;
815 return node.comment.removed
816 ? `*${i18n.t('removed')}*`
817 : node.comment.deleted
818 ? `*${i18n.t('deleted')}*`
819 : node.comment.content;
822 handleReplyClick(i: CommentNode) {
823 i.state.showReply = true;
827 handleEditClick(i: CommentNode) {
828 i.state.showEdit = true;
832 handleDeleteClick(i: CommentNode) {
833 let deleteForm: CommentFormI = {
834 content: i.props.node.comment.content,
835 edit_id: i.props.node.comment.id,
836 creator_id: i.props.node.comment.creator_id,
837 post_id: i.props.node.comment.post_id,
838 parent_id: i.props.node.comment.parent_id,
839 deleted: !i.props.node.comment.deleted,
842 WebSocketService.Instance.editComment(deleteForm);
845 handleSaveCommentClick(i: CommentNode) {
847 i.props.node.comment.saved == undefined
849 : !i.props.node.comment.saved;
850 let form: SaveCommentForm = {
851 comment_id: i.props.node.comment.id,
855 WebSocketService.Instance.saveComment(form);
857 i.state.saveLoading = true;
858 i.setState(this.state);
861 handleReplyCancel() {
862 this.state.showReply = false;
863 this.state.showEdit = false;
864 this.setState(this.state);
867 handleCommentUpvote(i: CommentNodeI) {
868 let new_vote = this.state.my_vote == 1 ? 0 : 1;
870 if (this.state.my_vote == 1) {
872 this.state.upvotes--;
873 } else if (this.state.my_vote == -1) {
874 this.state.downvotes--;
875 this.state.upvotes++;
876 this.state.score += 2;
878 this.state.upvotes++;
882 this.state.my_vote = new_vote;
884 let form: CommentLikeForm = {
885 comment_id: i.comment.id,
886 post_id: i.comment.post_id,
887 score: this.state.my_vote,
890 WebSocketService.Instance.likeComment(form);
891 this.setState(this.state);
895 handleCommentDownvote(i: CommentNodeI) {
896 let new_vote = this.state.my_vote == -1 ? 0 : -1;
898 if (this.state.my_vote == 1) {
899 this.state.score -= 2;
900 this.state.upvotes--;
901 this.state.downvotes++;
902 } else if (this.state.my_vote == -1) {
903 this.state.downvotes--;
906 this.state.downvotes++;
910 this.state.my_vote = new_vote;
912 let form: CommentLikeForm = {
913 comment_id: i.comment.id,
914 post_id: i.comment.post_id,
915 score: this.state.my_vote,
918 WebSocketService.Instance.likeComment(form);
919 this.setState(this.state);
923 handleModRemoveShow(i: CommentNode) {
924 i.state.showRemoveDialog = true;
928 handleModRemoveReasonChange(i: CommentNode, event: any) {
929 i.state.removeReason = event.target.value;
933 handleModRemoveSubmit(i: CommentNode) {
934 event.preventDefault();
935 let form: CommentFormI = {
936 content: i.props.node.comment.content,
937 edit_id: i.props.node.comment.id,
938 creator_id: i.props.node.comment.creator_id,
939 post_id: i.props.node.comment.post_id,
940 parent_id: i.props.node.comment.parent_id,
941 removed: !i.props.node.comment.removed,
942 reason: i.state.removeReason,
945 WebSocketService.Instance.editComment(form);
947 i.state.showRemoveDialog = false;
951 handleMarkRead(i: CommentNode) {
952 // if it has a user_mention_id field, then its a mention
953 if (i.props.node.comment.user_mention_id) {
954 let form: EditUserMentionForm = {
955 user_mention_id: i.props.node.comment.user_mention_id,
956 read: !i.props.node.comment.read,
958 WebSocketService.Instance.editUserMention(form);
960 let form: CommentFormI = {
961 content: i.props.node.comment.content,
962 edit_id: i.props.node.comment.id,
963 creator_id: i.props.node.comment.creator_id,
964 post_id: i.props.node.comment.post_id,
965 parent_id: i.props.node.comment.parent_id,
966 read: !i.props.node.comment.read,
969 WebSocketService.Instance.editComment(form);
972 i.state.readLoading = true;
973 i.setState(this.state);
976 handleModBanFromCommunityShow(i: CommentNode) {
977 i.state.showBanDialog = !i.state.showBanDialog;
978 i.state.banType = BanType.Community;
982 handleModBanShow(i: CommentNode) {
983 i.state.showBanDialog = !i.state.showBanDialog;
984 i.state.banType = BanType.Site;
988 handleModBanReasonChange(i: CommentNode, event: any) {
989 i.state.banReason = event.target.value;
993 handleModBanExpiresChange(i: CommentNode, event: any) {
994 i.state.banExpires = event.target.value;
998 handleModBanFromCommunitySubmit(i: CommentNode) {
999 i.state.banType = BanType.Community;
1000 i.setState(i.state);
1001 i.handleModBanBothSubmit(i);
1004 handleModBanSubmit(i: CommentNode) {
1005 i.state.banType = BanType.Site;
1006 i.setState(i.state);
1007 i.handleModBanBothSubmit(i);
1010 handleModBanBothSubmit(i: CommentNode) {
1011 event.preventDefault();
1013 if (i.state.banType == BanType.Community) {
1014 let form: BanFromCommunityForm = {
1015 user_id: i.props.node.comment.creator_id,
1016 community_id: i.props.node.comment.community_id,
1017 ban: !i.props.node.comment.banned_from_community,
1018 reason: i.state.banReason,
1019 expires: getUnixTime(i.state.banExpires),
1021 WebSocketService.Instance.banFromCommunity(form);
1023 let form: BanUserForm = {
1024 user_id: i.props.node.comment.creator_id,
1025 ban: !i.props.node.comment.banned,
1026 reason: i.state.banReason,
1027 expires: getUnixTime(i.state.banExpires),
1029 WebSocketService.Instance.banUser(form);
1032 i.state.showBanDialog = false;
1033 i.setState(i.state);
1036 handleShowConfirmAppointAsMod(i: CommentNode) {
1037 i.state.showConfirmAppointAsMod = true;
1038 i.setState(i.state);
1041 handleCancelConfirmAppointAsMod(i: CommentNode) {
1042 i.state.showConfirmAppointAsMod = false;
1043 i.setState(i.state);
1046 handleAddModToCommunity(i: CommentNode) {
1047 let form: AddModToCommunityForm = {
1048 user_id: i.props.node.comment.creator_id,
1049 community_id: i.props.node.comment.community_id,
1052 WebSocketService.Instance.addModToCommunity(form);
1053 i.state.showConfirmAppointAsMod = false;
1054 i.setState(i.state);
1057 handleShowConfirmAppointAsAdmin(i: CommentNode) {
1058 i.state.showConfirmAppointAsAdmin = true;
1059 i.setState(i.state);
1062 handleCancelConfirmAppointAsAdmin(i: CommentNode) {
1063 i.state.showConfirmAppointAsAdmin = false;
1064 i.setState(i.state);
1067 handleAddAdmin(i: CommentNode) {
1068 let form: AddAdminForm = {
1069 user_id: i.props.node.comment.creator_id,
1072 WebSocketService.Instance.addAdmin(form);
1073 i.state.showConfirmAppointAsAdmin = false;
1074 i.setState(i.state);
1077 handleShowConfirmTransferCommunity(i: CommentNode) {
1078 i.state.showConfirmTransferCommunity = true;
1079 i.setState(i.state);
1082 handleCancelShowConfirmTransferCommunity(i: CommentNode) {
1083 i.state.showConfirmTransferCommunity = false;
1084 i.setState(i.state);
1087 handleTransferCommunity(i: CommentNode) {
1088 let form: TransferCommunityForm = {
1089 community_id: i.props.node.comment.community_id,
1090 user_id: i.props.node.comment.creator_id,
1092 WebSocketService.Instance.transferCommunity(form);
1093 i.state.showConfirmTransferCommunity = false;
1094 i.setState(i.state);
1097 handleShowConfirmTransferSite(i: CommentNode) {
1098 i.state.showConfirmTransferSite = true;
1099 i.setState(i.state);
1102 handleCancelShowConfirmTransferSite(i: CommentNode) {
1103 i.state.showConfirmTransferSite = false;
1104 i.setState(i.state);
1107 handleTransferSite(i: CommentNode) {
1108 let form: TransferSiteForm = {
1109 user_id: i.props.node.comment.creator_id,
1111 WebSocketService.Instance.transferSite(form);
1112 i.state.showConfirmTransferSite = false;
1113 i.setState(i.state);
1116 get isCommentNew(): boolean {
1117 let now = moment.utc().subtract(10, 'minutes');
1118 let then = moment.utc(this.props.node.comment.published);
1119 return now.isBefore(then);
1122 handleCommentCollapse(i: CommentNode) {
1123 i.state.collapsed = !i.state.collapsed;
1124 i.setState(i.state);
1127 handleViewSource(i: CommentNode) {
1128 i.state.viewSource = !i.state.viewSource;
1129 i.setState(i.state);
1132 handleShowAdvanced(i: CommentNode) {
1133 i.state.showAdvanced = !i.state.showAdvanced;
1134 i.setState(i.state);
1139 if (this.state.my_vote == 1) {
1141 } else if (this.state.my_vote == -1) {
1142 return 'text-danger';
1144 return 'text-muted';
1148 get pointsTippy(): string {
1149 let points = i18n.t('number_of_points', {
1150 count: this.state.score,
1153 let upvotes = i18n.t('number_of_upvotes', {
1154 count: this.state.upvotes,
1157 let downvotes = i18n.t('number_of_downvotes', {
1158 count: this.state.downvotes,
1161 return `${points} • ${upvotes} • ${downvotes}`;