Co-authored-by: KyP <phanky.vn@proton.me>
// Only add the like if the score isnt 0
let do_add = like_form.score != 0 && (like_form.score == 1 || like_form.score == -1);
if do_add {
// Only add the like if the score isnt 0
let do_add = like_form.score != 0 && (like_form.score == 1 || like_form.score == -1);
if do_add {
- let like_form2 = like_form.clone();
- CommentLike::like(context.pool(), &like_form2)
+ CommentLike::like(context.pool(), &like_form)
.await
.map_err(|e| LemmyError::from_error_message(e, "couldnt_like_comment"))?;
}
.await
.map_err(|e| LemmyError::from_error_message(e, "couldnt_like_comment"))?;
}
// Only add the like if the score isnt 0
let do_add = like_form.score != 0 && (like_form.score == 1 || like_form.score == -1);
if do_add {
// Only add the like if the score isnt 0
let do_add = like_form.score != 0 && (like_form.score == 1 || like_form.score == -1);
if do_add {
- let like_form2 = like_form.clone();
- PostLike::like(context.pool(), &like_form2)
+ PostLike::like(context.pool(), &like_form)
.await
.map_err(|e| LemmyError::from_error_message(e, "couldnt_like_post"))?;
}
.await
.map_err(|e| LemmyError::from_error_message(e, "couldnt_like_post"))?;
}
.build();
// Create the comment
.build();
// Create the comment
- let comment_form2 = comment_form.clone();
let parent_path = parent_opt.clone().map(|t| t.path);
let parent_path = parent_opt.clone().map(|t| t.path);
- let inserted_comment = Comment::create(context.pool(), &comment_form2, parent_path.as_ref())
+ let inserted_comment = Comment::create(context.pool(), &comment_form, parent_path.as_ref())
.await
.map_err(|e| LemmyError::from_error_message(e, "couldnt_create_comment"))?;
.await
.map_err(|e| LemmyError::from_error_message(e, "couldnt_create_comment"))?;