mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-03 03:37:28 +01:00
Review hypertext: Add no reviews message
This commit is contained in:
parent
f621cd13d2
commit
9131b29b48
@ -322,7 +322,8 @@ def package_reviews_as_hypertext(package: Package, formspec_version: int = 7):
|
||||
links[f"link_{link_counter}"] = url
|
||||
return f"<action name=link_{link_counter}>{escape_hypertext(label)}</action>"
|
||||
|
||||
for review in package.reviews:
|
||||
reviews = package.reviews.all()
|
||||
for review in reviews:
|
||||
review: PackageReview
|
||||
html = render_markdown(review.thread.first_reply.comment)
|
||||
content = html_to_minetest(html, package.get_url("packages.view", absolute=True),
|
||||
@ -332,6 +333,9 @@ def package_reviews_as_hypertext(package: Package, formspec_version: int = 7):
|
||||
comments = make_link(abs_url_for("threads.view", id=review.thread.id), "Comments")
|
||||
body += f"{author} {rating}\n<big>{escape_hypertext(review.thread.title)}</big>\n{content}\n{comments}\n\n"
|
||||
|
||||
if len(reviews) == 0:
|
||||
body += escape_hypertext(gettext("No reviews available."))
|
||||
|
||||
return {
|
||||
"head": HEAD,
|
||||
"body": body,
|
||||
|
Loading…
Reference in New Issue
Block a user