mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-07-10 14:09:20 +02:00
[v12.0/forgejo] fix(email): actions notification template confuses branch with PR (#8455)
**Backport:** https://codeberg.org/forgejo/forgejo/pulls/8448 When a mail notification is sent because of a failed pull request run, the body will show: Branch: #661 (f57df45) where #661 is the number of the pull request and not the branch. This is because run.PrettyRef() is used and has a misleading special case returning a PR number instead of a ref. Remove the textual description as it can easily be discovered from the run web page linked in the mail. Co-authored-by: Earl Warren <contact@earl-warren.org> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8455 Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org> Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org> Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
This commit is contained in:
parent
a1e3bace72
commit
eb543dcbdb
4 changed files with 3 additions and 5 deletions
|
@ -92,7 +92,7 @@
|
|||
"mail.actions.not_successful_run": "Workflow %[1]s failed in repository %[2]s",
|
||||
"mail.actions.run_info_cur_status": "This Run's Status: %[1]s (just updated from %[2]s)",
|
||||
"mail.actions.run_info_previous_status": "Previous Run's Status: %[1]s",
|
||||
"mail.actions.run_info_ref": "Branch: %[1]s (%[2]s)",
|
||||
"mail.actions.run_info_sha": "Commit: %[1]s",
|
||||
"mail.actions.run_info_trigger": "Triggered because: %[1]s by: %[2]s",
|
||||
"repo.diff.commit.next-short": "Next",
|
||||
"repo.diff.commit.previous-short": "Prev",
|
||||
|
|
|
@ -60,7 +60,6 @@ func sendMailActionRun(to *user_model.User, run *actions_model.ActionRun, priorS
|
|||
if len(commitSHA) > 7 {
|
||||
commitSHA = commitSHA[:7]
|
||||
}
|
||||
branch := run.PrettyRef()
|
||||
|
||||
data := map[string]any{
|
||||
"locale": locale,
|
||||
|
@ -73,7 +72,6 @@ func sendMailActionRun(to *user_model.User, run *actions_model.ActionRun, priorS
|
|||
"LastRun": lastRun,
|
||||
"PriorStatus": priorStatus,
|
||||
"CommitSHA": commitSHA,
|
||||
"Branch": branch,
|
||||
"IsSuccess": run.Status.IsSuccess(),
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ func getActionsNowDoneTestOrg(t *testing.T, name, email string, owner *user_mode
|
|||
}
|
||||
|
||||
func assertTranslatedLocaleMailActionsNowDone(t *testing.T, msgBody string) {
|
||||
AssertTranslatedLocale(t, msgBody, "mail.actions.successful_run_after_failure", "mail.actions.not_successful_run", "mail.actions.run_info_cur_status", "mail.actions.run_info_ref", "mail.actions.run_info_previous_status", "mail.actions.run_info_trigger", "mail.view_it_on")
|
||||
AssertTranslatedLocale(t, msgBody, "mail.actions.successful_run_after_failure", "mail.actions.not_successful_run", "mail.actions.run_info_cur_status", "mail.actions.run_info_sha", "mail.actions.run_info_previous_status", "mail.actions.run_info_trigger", "mail.view_it_on")
|
||||
}
|
||||
|
||||
func TestActionRunNowDoneStatusMatrix(t *testing.T) {
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<br />
|
||||
|
||||
{{.locale.Tr "mail.actions.run_info_cur_status" .Run.Status .PriorStatus}}<br />
|
||||
{{.locale.Tr "mail.actions.run_info_ref" .Branch .CommitSHA}}<br />
|
||||
{{.locale.Tr "mail.actions.run_info_sha" .CommitSHA}}<br />
|
||||
{{if .LastRun}}
|
||||
{{.locale.Tr "mail.actions.run_info_previous_status" .LastRun.Status}}<br />
|
||||
{{end}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue