feat(ui): add links to review request targets in issue comments (#8239)

- Add links to review request targets in issue comments
- Fix links to ghost users/orgs/teams to be empty

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8239
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Robert Wolff <mahlzahn@posteo.de>
Co-committed-by: Robert Wolff <mahlzahn@posteo.de>
This commit is contained in:
Robert Wolff 2025-07-23 04:45:58 +02:00 committed by Gusted
parent 82daae4c7c
commit 7643bdd2b5
11 changed files with 256 additions and 21 deletions

View file

@ -275,10 +275,18 @@ func RenderUser(ctx context.Context, user user_model.User) template.HTML {
html.EscapeString(user.GetDisplayName())))
}
func RenderReviewRequest(users []issues_model.RequestReviewTarget) template.HTML {
func RenderReviewRequest(ctx context.Context, users []issues_model.RequestReviewTarget) template.HTML {
usernames := make([]string, 0, len(users))
for _, user := range users {
usernames = append(usernames, html.EscapeString(user.Name()))
if user.ID() > 0 {
usernames = append(usernames, fmt.Sprintf(
"<a href='%s' rel='nofollow'><strong>%s</strong></a>",
user.Link(ctx), html.EscapeString(user.Name())))
} else {
usernames = append(usernames, fmt.Sprintf(
"<strong>%s</strong>",
html.EscapeString(user.Name())))
}
}
htmlCode := `<span class="review-request-list">`