]> Untitled Git - lemmy.git/commitdiff
Removing disabled from comment and post upvoting, showing toast now. Fixes #450
authorDessalines <tyhou13@gmx.com>
Sat, 25 Jan 2020 18:39:22 +0000 (13:39 -0500)
committerDessalines <tyhou13@gmx.com>
Sat, 25 Jan 2020 18:39:22 +0000 (13:39 -0500)
ui/src/components/comment-node.tsx
ui/src/components/post-listing.tsx

index 046fc88d3f05ba46d503a0ef6edbf96ed0904d07..a42d096e475abd43e560ab48bb59aa9bf130455b 100644 (file)
@@ -117,7 +117,6 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
               .viewOnly && 'no-click'}`}
           >
             <button
-              disabled={!UserService.Instance.user}
               className={`btn p-0 ${
                 node.comment.my_vote == 1 ? 'text-info' : 'text-muted'
               }`}
@@ -138,7 +137,6 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
             </div>
             {WebSocketService.Instance.site.enable_downvotes && (
               <button
-                disabled={!UserService.Instance.user}
                 className={`btn p-0 ${
                   node.comment.my_vote == -1 ? 'text-danger' : 'text-muted'
                 }`}
@@ -761,9 +759,11 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
   }
 
   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,
@@ -773,9 +773,11 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
   }
 
   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,
index aab2cea582846490f7863e78de86b19b2a6d8275..c9a29e87fa3963b892d66ab9d580366e9d707bac 100644 (file)
@@ -119,7 +119,6 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
       <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'
             }`}
@@ -138,7 +137,6 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
           <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'
               }`}
@@ -740,17 +738,22 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
   }
 
   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,