]> Untitled Git - lemmy-ui.git/commitdiff
Add preventDefaults to stop form submits on likes. Fixes #153
authorDessalines <tyhou13@gmx.com>
Tue, 2 Feb 2021 16:52:44 +0000 (11:52 -0500)
committerDessalines <tyhou13@gmx.com>
Tue, 2 Feb 2021 16:52:44 +0000 (11:52 -0500)
src/shared/components/comment-node.tsx
src/shared/components/post-listing.tsx

index e86a342823040f4be70a25ec04ff45c9697912ca..071c23889ef3f5173598358b9c944b7e988453e0 100644 (file)
@@ -882,7 +882,8 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
     this.setState(this.state);
   }
 
-  handleCommentUpvote(i: CommentNodeI) {
+  handleCommentUpvote(i: CommentNodeI, event: any) {
+    event.preventDefault();
     let new_vote = this.state.my_vote == 1 ? 0 : 1;
 
     if (this.state.my_vote == 1) {
@@ -910,7 +911,8 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
     setupTippy();
   }
 
-  handleCommentDownvote(i: CommentNodeI) {
+  handleCommentDownvote(i: CommentNodeI, event: any) {
+    event.preventDefault();
     let new_vote = this.state.my_vote == -1 ? 0 : -1;
 
     if (this.state.my_vote == 1) {
index b485a0a08ea4a8ec64cf4824cc8b66695f3c8c0f..41494c2fa4fef7ebc18fd2e47f3eda073f0eecdc 100644 (file)
@@ -1155,7 +1155,8 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
     );
   }
 
-  handlePostLike(i: PostListing) {
+  handlePostLike(i: PostListing, event: any) {
+    event.preventDefault();
     if (!UserService.Instance.user) {
       this.context.router.history.push(`/login`);
     }
@@ -1187,7 +1188,8 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
     setupTippy();
   }
 
-  handlePostDisLike(i: PostListing) {
+  handlePostDisLike(i: PostListing, event: any) {
+    event.preventDefault();
     if (!UserService.Instance.user) {
       this.context.router.history.push(`/login`);
     }