Skip to content

Commit fdebefa

Browse files
committed
terrible
1 parent d41aee8 commit fdebefa

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

services/mailer/mail_workflow_run.go

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ package mailer
55

66
import (
77
"bytes"
8-
"context"
9-
"fmt"
10-
"sort"
11-
128
actions_model "code.gitea.io/gitea/models/actions"
139
"code.gitea.io/gitea/models/db"
1410
repo_model "code.gitea.io/gitea/models/repo"
@@ -19,6 +15,9 @@ import (
1915
"code.gitea.io/gitea/modules/translation"
2016
"code.gitea.io/gitea/services/convert"
2117
sender_service "code.gitea.io/gitea/services/mailer/sender"
18+
"context"
19+
"fmt"
20+
"sort"
2221
)
2322

2423
const tplWorkflowRun = "notify/workflow_run"
@@ -53,16 +52,13 @@ func sendActionsWorkflowRunStatusEmail(ctx context.Context, repo *repo_model.Rep
5352
if err != nil {
5453
log.Error("GetRunJobsByRunID: %v", err)
5554
return
56-
} else {
57-
sort.SliceStable(jobs, func(i, j int) bool {
58-
si := jobs[i].Status
59-
sj := jobs[j].Status
60-
if si == sj || si.IsSuccess() {
61-
return false
62-
}
63-
return si < sj
64-
})
6555
}
56+
sort.SliceStable(jobs, func(i, j int) bool {
57+
si := jobs[i].Status
58+
sj := jobs[j].Status
59+
return !(si == sj || si.IsSuccess()) && si < sj
60+
})
61+
6662
convertedJobs := make([]convertedWorkflowJob, 0, len(jobs))
6763
for _, job := range jobs {
6864
converted0, err := convert.ToActionWorkflowJob(ctx, repo, nil, job)

0 commit comments

Comments
 (0)