mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-03 03:37:28 +01:00
Review hypertext: Fix links in reviews not working
This commit is contained in:
parent
7f834dbf8c
commit
52df207088
@ -327,11 +327,14 @@ def package_reviews_as_hypertext(package: Package, formspec_version: int = 7):
|
|||||||
review: PackageReview
|
review: PackageReview
|
||||||
html = render_markdown(review.thread.first_reply.comment)
|
html = render_markdown(review.thread.first_reply.comment)
|
||||||
content = html_to_minetest(html, package.get_url("packages.view", absolute=True),
|
content = html_to_minetest(html, package.get_url("packages.view", absolute=True),
|
||||||
formspec_version, False, f"review_{review.id}_")["body"].strip()
|
formspec_version, False, f"review_{review.id}_")
|
||||||
|
links.update(content["links"])
|
||||||
|
comment_body = content["body"]
|
||||||
|
|
||||||
author = make_link(abs_url_for("users.profile", username=review.author.username), review.author.display_name)
|
author = make_link(abs_url_for("users.profile", username=review.author.username), review.author.display_name)
|
||||||
rating = ["<thumbsdown>", "<thumbsdown>", "<neutral>", "<thumbsup>", "<thumbsup>"][review.rating - 1]
|
rating = ["<thumbsdown>", "<thumbsdown>", "<neutral>", "<thumbsup>", "<thumbsup>"][review.rating - 1]
|
||||||
comments = make_link(abs_url_for("threads.view", id=review.thread.id), "Comments")
|
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"
|
body += f"{author} {rating}\n<big>{escape_hypertext(review.thread.title)}</big>\n{comment_body}\n{comments}\n\n"
|
||||||
|
|
||||||
if len(reviews) == 0:
|
if len(reviews) == 0:
|
||||||
body += escape_hypertext(gettext("No reviews available."))
|
body += escape_hypertext(gettext("No reviews available."))
|
||||||
|
Loading…
Reference in New Issue
Block a user