mirror of
https://github.com/minetest/contentdb.git
synced 2024-11-09 17:13:45 +01:00
parent
86e1f57198
commit
c1edea4dc3
@ -161,15 +161,19 @@ def handle_review_vote(package: Package, review_id: int):
|
||||
flash("You can't vote on your own reviews!", "danger")
|
||||
return
|
||||
|
||||
is_positive = isYes(request.form["is_positive"])
|
||||
|
||||
vote = PackageReviewVote.query.filter_by(review=review, user=current_user).first()
|
||||
if vote is None:
|
||||
vote = PackageReviewVote()
|
||||
vote.review = review
|
||||
vote.user = current_user
|
||||
vote.is_positive = isYes(request.form["is_positive"])
|
||||
vote.is_positive = is_positive
|
||||
db.session.add(vote)
|
||||
elif vote.is_positive == is_positive:
|
||||
db.session.delete(vote)
|
||||
else:
|
||||
vote.is_positive = isYes(request.form["is_positive"])
|
||||
vote.is_positive = is_positive
|
||||
|
||||
review.update_score()
|
||||
db.session.commit()
|
||||
|
Loading…
Reference in New Issue
Block a user