Skip to content

Commit c20e93d

Browse files
committed
Fix missing repo link in issue/pull assigned emails (go-gitea#17183)
Backport go-gitea#17183 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 go-gitea#17160 Signed-off-by: Andrew Thornton <[email protected]>
1 parent 766272b commit c20e93d

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

options/locale/locale_en-US.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,8 @@ reset_password.text = Please click the following link to recover your account wi
345345
346346
register_success = Registration successful
347347
348-
issue_assigned.pull = @%[1]s assigned you to the pull request %[2]s in repository %[3]s.
349-
issue_assigned.issue = @%[1]s assigned you to the issue %[2]s in repository %[3]s.
348+
issue_assigned.pull = @%[1]s assigned you to pull request %[2]s in repository %[3]s.
349+
issue_assigned.issue = @%[1]s assigned you to issue %[2]s in repository %[3]s.
350350
351351
issue.x_mentioned_you = <b>@%s</b> mentioned you:
352352
issue.action.force_push = <b>%[1]s</b> force-pushed the <b>%[2]s</b> from %[3]s to %[4]s.

options/locale/locale_ru-RU.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ reset_password.text=Пожалуйста, перейдите по ссылке,
345345
346346
register_success=Регистрация прошла успешно
347347
348-
issue_assigned.pull=@%[1] назначил вам запрос на слияние %[2] в репозитории %[3].
348+
issue_assigned.pull=@%[1]s назначил вам запрос на слияние %[2]s в репозитории %[3]s.
349349
issue_assigned.issue=@%[1]s назначил вам задачу %[2]s в репозитории %[3]s.
350350
351351
issue.x_mentioned_you=<b>@%s</b> упомянул вас:

services/mailer/mail.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,16 @@ func sanitizeSubject(subject string) string {
344344

345345
// SendIssueAssignedMail composes and sends issue assigned email
346346
func SendIssueAssignedMail(issue *models.Issue, doer *models.User, content string, comment *models.Comment, recipients []*models.User) error {
347+
if setting.MailService == nil {
348+
// No mail service configured
349+
return nil
350+
}
351+
352+
if err := issue.LoadRepo(); err != nil {
353+
log.Error("Unable to load rep [%d] for issue #%d [%d]. Error: %v", issue.RepoID, issue.Index, issue.ID, err)
354+
return err
355+
}
356+
347357
langMap := make(map[string][]*models.User)
348358
for _, user := range recipients {
349359
langMap[user.Language] = append(langMap[user.Language], user)

templates/mail/issue/assigned.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<title>{{.Subject}}</title>
99
</head>
1010

11-
{{$repo_url := printf "<a href='%s'>%s</a>" .Release.Repo.HTMLURL .Release.Repo.FullName}}
11+
{{$repo_url := printf "<a href='%s'>%s</a>" .Issue.Repo.HTMLURL .Issue.Repo.FullName}}
1212
{{$link := printf "<a href='%s'>#%d</a>" .Link .Issue.Index}}
1313
<body>
1414
<p>

0 commit comments

Comments
 (0)