Skip to content

Commit

Permalink
Review hypertext: Fix links in reviews not working
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenwardy committed Oct 8, 2024
1 parent 7f834db commit 52df207
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/utils/minetest_hypertext.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,11 +327,14 @@ def make_link(url: str, label: str):
review: PackageReview
html = render_markdown(review.thread.first_reply.comment)
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)
rating = ["<thumbsdown>", "<thumbsdown>", "<neutral>", "<thumbsup>", "<thumbsup>"][review.rating - 1]
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:
body += escape_hypertext(gettext("No reviews available."))
Expand Down

1 comment on commit 52df207

@grorp
Copy link
Member

@grorp grorp commented on 52df207 Oct 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was already going to complain about this in my review of minetest/minetest#15254 :)
Works now 👍

Please sign in to comment.