Skip to content

Commit

Permalink
Fix missing repo link in issue/pull assigned emails
Browse files Browse the repository at this point in the history
There was a mistake in the template file: `templates/mail/issue/assigned.tmpl`
where the repourl was generated from a non-existent release instead of the issue.

This PR changes this to use the issue but also ensure that the issue repo is loaded.

It also slightly improves the English locale string.

Fix #17160

Signed-off-by: Andrew Thornton <[email protected]>
  • Loading branch information
zeripath committed Sep 29, 2021
1 parent d304106 commit 9e3438d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,8 @@ reset_password.text = Please click the following link to recover your account wi
register_success = Registration successful
issue_assigned.pull = @%[1]s assigned you to the pull request %[2]s in repository %[3]s.
issue_assigned.issue = @%[1]s assigned you to the issue %[2]s in repository %[3]s.
issue_assigned.pull = @%[1]s assigned you to pull request %[2]s in repository %[3]s.
issue_assigned.issue = @%[1]s assigned you to issue %[2]s in repository %[3]s.
issue.x_mentioned_you = <b>@%s</b> mentioned you:
issue.action.force_push = <b>%[1]s</b> force-pushed the <b>%[2]s</b> from %[3]s to %[4]s.
Expand Down
6 changes: 6 additions & 0 deletions services/mailer/mail.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,12 @@ func SendIssueAssignedMail(issue *models.Issue, doer *models.User, content strin
// No mail service configured
return nil
}

if err := issue.LoadRepo(); err != nil {
log.Error("Unable to load rep [%d] for issue #%d [%d]. Error: %v", issue.RepoID, issue.Index, issue.ID, err)
return err
}

langMap := make(map[string][]*models.User)
for _, user := range recipients {
langMap[user.Language] = append(langMap[user.Language], user)
Expand Down
2 changes: 1 addition & 1 deletion templates/mail/issue/assigned.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<title>{{.Subject}}</title>
</head>

{{$repo_url := printf "<a href='%s'>%s</a>" .Release.Repo.HTMLURL .Release.Repo.FullName}}
{{$repo_url := printf "<a href='%s'>%s</a>" .Issue.Repo.HTMLURL .Issue.Repo.FullName}}
{{$link := printf "<a href='%s'>#%d</a>" .Link .Issue.Index}}
<body>
<p>
Expand Down

0 comments on commit 9e3438d

Please sign in to comment.