Open platform to collect and prioritize feedback
fix: don't open votes modal for visitors (#661)
Guilherme Oenninge628911872bc
diff --git a/public/pages/ShowPost/components/VotesPanel.tsx b/public/pages/ShowPost/components/VotesPanel.tsxindex 1f8802ff5..c9546f4ef 100644--- a/public/pages/ShowPost/components/VotesPanel.tsx+++ b/public/pages/ShowPost/components/VotesPanel.tsx@@ -24,19 +24,24 @@ export class VotesPanel extends React.Component<VotesPanelProps, VotesPanelState}private showModal = () => {- this.setState({ showModal: true });+ if (this.canShowAll()) {+ this.setState({ showModal: true });+ }};private hideModal = () => {this.setState({ showModal: false });};+ private canShowAll = () => {+ return Fider.session.isAuthenticated && Fider.session.user.isCollaborator;+ };+public render() {const extraVotesCount = this.props.post.votesCount - this.props.votes.length;- const canShowAll = Fider.session.isAuthenticated && Fider.session.user.isCollaborator;const moreVotesClassName = classSet({"l-votes-more": true,- clickable: canShowAll+ clickable: this.canShowAll()});return (@@ -52,7 +57,7 @@ export class VotesPanel extends React.Component<VotesPanelProps, VotesPanelState+{extraVotesCount} more</span>)}- {this.props.votes.length > 0 && extraVotesCount === 0 && canShowAll && (+ {this.props.votes.length > 0 && extraVotesCount === 0 && this.canShowAll() && (<span onClick={this.showModal} className={moreVotesClassName}>see details</span>