Skip to content

Commit

Permalink
Review hypertext: Add no reviews message
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenwardy committed Oct 8, 2024
1 parent f621cd1 commit 9131b29
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/utils/minetest_hypertext.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,8 @@ def make_link(url: str, label: str):
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),
Expand All @@ -332,6 +333,9 @@ def make_link(url: str, label: str):
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,
Expand Down

0 comments on commit 9131b29

Please sign in to comment.