mirror of
https://github.com/minetest/contentdb.git
synced 2025-03-14 14:22:30 +01:00
Show "Edit Review" button when a user already has a review
This commit is contained in:
@ -158,12 +158,13 @@ def view(package):
|
||||
elif not current_user.rank.atLeast(UserRank.EDITOR) and not current_user == package.author:
|
||||
threads = threads.filter(or_(Thread.private == False, Thread.author == current_user))
|
||||
|
||||
has_review = PackageReview.query.filter_by(package=package, author=current_user).count() > 0
|
||||
|
||||
return render_template("packages/view.html", \
|
||||
package=package, releases=releases, requests=requests, \
|
||||
alternatives=alternatives, similar_topics=similar_topics, \
|
||||
review_thread=review_thread, topic_error=topic_error, topic_error_lvl=topic_error_lvl, \
|
||||
threads=threads.all())
|
||||
threads=threads.all(), has_review=has_review)
|
||||
|
||||
|
||||
@bp.route("/packages/<author>/<name>/download/")
|
||||
|
@ -463,7 +463,17 @@
|
||||
|
||||
{% from "macros/reviews.html" import render_reviews, render_review_form, render_review_preview %}
|
||||
{% if current_user.is_authenticated %}
|
||||
{{ render_review_form(package, current_user) }}
|
||||
{% if has_review %}
|
||||
<p>
|
||||
<a
|
||||
class="btn btn-primary"
|
||||
href="{{ url_for('packages.review', author=package.author.username, name=package.name) }}">
|
||||
{{ _("Edit Review") }}
|
||||
</a>
|
||||
</p>
|
||||
{% else %}
|
||||
{{ render_review_form(package, current_user) }}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{{ render_review_preview(package) }}
|
||||
{% endif %}
|
||||
|
Reference in New Issue
Block a user