Prevent users from reviewing their own packages

This commit is contained in:
rubenwardy 2020-07-09 05:47:26 +01:00
parent 45877bb3a4
commit 078765fe44
1 changed files with 4 additions and 0 deletions

View File

@ -34,6 +34,10 @@ class ReviewForm(FlaskForm):
@login_required
@is_package_page
def review(package):
if current_user in package.maintainers:
flash("You can't review your own package!", "danger")
return redirect(package.getDetailsURL())
review = PackageReview.query.filter_by(package=package, author=current_user).first()
form = ReviewForm(formdata=request.form, obj=review)