.viewOnly && 'no-click'}`}
>
<button
- disabled={!UserService.Instance.user}
className={`btn p-0 ${
node.comment.my_vote == 1 ? 'text-info' : 'text-muted'
}`}
</div>
{WebSocketService.Instance.site.enable_downvotes && (
<button
- disabled={!UserService.Instance.user}
className={`btn p-0 ${
node.comment.my_vote == -1 ? 'text-danger' : 'text-muted'
}`}
}
handleCommentUpvote(i: CommentNodeI) {
- this.setState({
- upvoteLoading: true,
- });
+ if (UserService.Instance.user) {
+ this.setState({
+ upvoteLoading: true,
+ });
+ }
let form: CommentLikeForm = {
comment_id: i.comment.id,
post_id: i.comment.post_id,
}
handleCommentDownvote(i: CommentNodeI) {
- this.setState({
- downvoteLoading: true,
- });
+ if (UserService.Instance.user) {
+ this.setState({
+ downvoteLoading: true,
+ });
+ }
let form: CommentLikeForm = {
comment_id: i.comment.id,
post_id: i.comment.post_id,
<div class="listing col-12">
<div className={`vote-bar mr-2 float-left small text-center`}>
<button
- disabled={!UserService.Instance.user}
className={`btn p-0 ${
post.my_vote == 1 ? 'text-info' : 'text-muted'
}`}
<div class={`font-weight-bold text-muted`}>{post.score}</div>
{WebSocketService.Instance.site.enable_downvotes && (
<button
- disabled={!UserService.Instance.user}
className={`btn p-0 ${
post.my_vote == -1 ? 'text-danger' : 'text-muted'
}`}
}
handlePostLike(i: PostListing) {
- i.setState({ upvoteLoading: true });
+ if (UserService.Instance.user) {
+ i.setState({ upvoteLoading: true });
+ }
let form: CreatePostLikeForm = {
post_id: i.props.post.id,
score: i.props.post.my_vote == 1 ? 0 : 1,
};
+
WebSocketService.Instance.likePost(form);
}
handlePostDisLike(i: PostListing) {
- i.setState({ downvoteLoading: true });
+ if (UserService.Instance.user) {
+ i.setState({ downvoteLoading: true });
+ }
let form: CreatePostLikeForm = {
post_id: i.props.post.id,