Skip to content

Commit 09b7707

Browse files
authored
Merge branch 'main' into main
2 parents 4ba29b3 + e8ac6a9 commit 09b7707

File tree

36 files changed

+112
-65
lines changed

36 files changed

+112
-65
lines changed

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,25 @@ This changelog goes through all the changes that have been made in each release
44
without substantial changes to our git log; to see the highlights of what has
55
been added to each release, please refer to the [blog](https://blog.gitea.io).
66

7+
## [1.18.3](https://github.com/go-gitea/gitea/releases/tag/v1.18.3) - 2023-01-23
8+
9+
* SECURITY
10+
* Prevent multiple `To` recipients (#22566) (#22569)
11+
* BUGFIXES
12+
* Truncate commit summary on repo files table. (#22551) (#22552)
13+
* Mute all links in issue timeline (#22534)
14+
15+
## [1.18.2](https://github.com/go-gitea/gitea/releases/tag/v1.18.2) - 2023-01-19
16+
17+
* BUGFIXES
18+
* Fix issue not auto-closing when it includes a reference to a branch (#22514) (#22521)
19+
* Fix invalid issue branch reference if not specified in template (#22513) (#22520)
20+
* Fix 500 error viewing pull request when fork has pull requests disabled (#22512) (#22515)
21+
* Reliable selection of admin user (#22509) (#22511)
22+
* Set disable_gravatar/enable_federated_avatar when offline mode is true (#22479) (#22496)
23+
* BUILD
24+
* cgo cross-compile for freebsd (#22397) (#22519)
25+
726
## [1.18.1](https://github.com/go-gitea/gitea/releases/tag/v1.18.1) - 2023-01-17
827

928
* API

DCO

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ Developer Certificate of Origin
22
Version 1.1
33

44
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
5-
660 York Street, Suite 102,
6-
San Francisco, CA 94110 USA
75

86
Everyone is permitted to copy and distribute verbatim copies of this
97
license document, but changing it is not allowed.
@@ -33,4 +31,4 @@ By making a contribution to this project, I certify that:
3331
are public and that a record of the contribution (including all
3432
personal information I submit with it, including my sign-off) is
3533
maintained indefinitely and may be redistributed consistent with
36-
this project or the open source license(s) involved.
34+
this project or the open source license(s) involved.

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
<a href="https://discord.gg/Gitea" title="Join the Discord chat at https://discord.gg/Gitea">
1313
<img src="https://img.shields.io/discord/322538954119184384.svg">
1414
</a>
15-
<a href="https://codecov.io/gh/go-gitea/gitea" title="Codecov">
15+
<a href="https://app.codecov.io/gh/go-gitea/gitea" title="Codecov">
1616
<img src="https://codecov.io/gh/go-gitea/gitea/branch/main/graph/badge.svg">
1717
</a>
1818
<a href="https://goreportcard.com/report/code.gitea.io/gitea" title="Go Report Card">
1919
<img src="https://goreportcard.com/badge/code.gitea.io/gitea">
2020
</a>
21-
<a href="https://godoc.org/code.gitea.io/gitea" title="GoDoc">
22-
<img src="https://godoc.org/code.gitea.io/gitea?status.svg">
21+
<a href="https://pkg.go.dev/code.gitea.io/gitea" title="GoDoc">
22+
<img src="https://pkg.go.dev/badge/code.gitea.io/gitea?status.svg">
2323
</a>
2424
<a href="https://github.com/go-gitea/gitea/releases/latest" title="GitHub release">
2525
<img src="https://img.shields.io/github/release/go-gitea/gitea.svg">
@@ -45,7 +45,7 @@
4545
<a href="https://www.tickgit.com/browse?repo=github.com/go-gitea/gitea&branch=main" title="TODOs">
4646
<img src="https://badgen.net/https/api.tickgit.com/badgen/github.com/go-gitea/gitea/main">
4747
</a>
48-
<a href="https://www.bountysource.com/teams/gitea" title="Bountysource">
48+
<a href="https://app.bountysource.com/teams/gitea" title="Bountysource">
4949
<img src="https://img.shields.io/bountysource/team/gitea/activity">
5050
</a>
5151
</p>

README_ZH.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
<a href="https://discord.gg/Gitea" title="Join the Discord chat at https://discord.gg/Gitea">
1313
<img src="https://img.shields.io/discord/322538954119184384.svg">
1414
</a>
15-
<a href="https://codecov.io/gh/go-gitea/gitea" title="Codecov">
15+
<a href="https://app.codecov.io/gh/go-gitea/gitea" title="Codecov">
1616
<img src="https://codecov.io/gh/go-gitea/gitea/branch/main/graph/badge.svg">
1717
</a>
1818
<a href="https://goreportcard.com/report/code.gitea.io/gitea" title="Go Report Card">
1919
<img src="https://goreportcard.com/badge/code.gitea.io/gitea">
2020
</a>
21-
<a href="https://godoc.org/code.gitea.io/gitea" title="GoDoc">
22-
<img src="https://godoc.org/code.gitea.io/gitea?status.svg">
21+
<a href="https://pkg.go.dev/code.gitea.io/gitea" title="GoDoc">
22+
<img src="https://pkg.go.dev/badge/code.gitea.io/gitea?status.svg">
2323
</a>
2424
<a href="https://github.com/go-gitea/gitea/releases/latest" title="GitHub release">
2525
<img src="https://img.shields.io/github/release/go-gitea/gitea.svg">
@@ -45,7 +45,7 @@
4545
<a href="https://www.tickgit.com/browse?repo=github.com/go-gitea/gitea&branch=main" title="TODOs">
4646
<img src="https://badgen.net/https/api.tickgit.com/badgen/github.com/go-gitea/gitea/main">
4747
</a>
48-
<a href="https://img.shields.io/bountysource/team/gitea" title="Bountysource">
48+
<a href="https://app.bountysource.com/teams/gitea" title="Bountysource">
4949
<img src="https://img.shields.io/bountysource/team/gitea/activity">
5050
</a>
5151
</p>

custom/conf/app.example.ini

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1725,7 +1725,7 @@ ROUTER = console
17251725
;INTERVAL = 60
17261726
;;
17271727
;; For "redis" and "memcache", connection host address
1728-
;; redis: network=tcp,addr=:6379,password=macaron,db=0,pool_size=100,idle_timeout=180
1728+
;; redis: `redis://127.0.0.1:6379/0?pool_size=100&idle_timeout=180s`
17291729
;; memcache: `127.0.0.1:11211`
17301730
;; twoqueue: `{"size":50000,"recent_ratio":0.25,"ghost_ratio":0.5}` or `50000`
17311731
;HOST =
@@ -1764,7 +1764,7 @@ ROUTER = console
17641764
;; Provider config options
17651765
;; memory: doesn't have any config yet
17661766
;; file: session file path, e.g. `data/sessions`
1767-
;; redis: network=tcp,addr=:6379,password=macaron,db=0,pool_size=100,idle_timeout=180
1767+
;; redis: `redis://127.0.0.1:6379/0?pool_size=100&idle_timeout=180s`
17681768
;; mysql: go-sql-driver/mysql dsn config string, e.g. `root:password@/session_table`
17691769
;PROVIDER_CONFIG = data/sessions ; Relative paths will be made absolute against _`AppWorkPath`_.
17701770
;;
@@ -2384,8 +2384,8 @@ ROUTER = console
23842384
;QUEUE_LENGTH = 1000
23852385
;;
23862386
;; Task queue connection string, available only when `QUEUE_TYPE` is `redis`.
2387-
;; If there is a password of redis, use `addrs=127.0.0.1:6379 password=123 db=0`.
2388-
;QUEUE_CONN_STR = "addrs=127.0.0.1:6379 db=0"
2387+
;; If there is a password of redis, use `redis://127.0.0.1:6379/0?pool_size=100&idle_timeout=180s`.
2388+
;QUEUE_CONN_STR = "redis://127.0.0.1:6379/0?pool_size=100&idle_timeout=180s"
23892389

23902390
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
23912391
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

models/project/project.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,15 @@ func (p *Project) Link() string {
123123
log.Error("LoadOwner: %v", err)
124124
return ""
125125
}
126-
return fmt.Sprintf("/%s/-/projects/%d", p.Owner.Name, p.ID)
126+
return fmt.Sprintf("%s/-/projects/%d", p.Owner.HomeLink(), p.ID)
127127
}
128128
if p.RepoID > 0 {
129129
err := p.LoadRepo(db.DefaultContext)
130130
if err != nil {
131131
log.Error("LoadRepo: %v", err)
132132
return ""
133133
}
134-
return fmt.Sprintf("/%s/projects/%d", p.Repo.RepoPath(), p.ID)
134+
return fmt.Sprintf("%s/projects/%d", p.Repo.Link(), p.ID)
135135
}
136136
return ""
137137
}

modules/notification/action/action.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func (a *actionNotifier) NotifyNewIssue(ctx context.Context, issue *issues_model
5656
}
5757

5858
// NotifyIssueChangeStatus notifies close or reopen issue to notifiers
59-
func (a *actionNotifier) NotifyIssueChangeStatus(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, actionComment *issues_model.Comment, closeOrReopen bool) {
59+
func (a *actionNotifier) NotifyIssueChangeStatus(ctx context.Context, doer *user_model.User, commitID string, issue *issues_model.Issue, actionComment *issues_model.Comment, closeOrReopen bool) {
6060
// Compose comment action, could be plain comment, close or reopen issue/pull request.
6161
// This object will be used to notify watchers in the end of function.
6262
act := &activities_model.Action{

modules/notification/base/notifier.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type Notifier interface {
2323
NotifyRenameRepository(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, oldRepoName string)
2424
NotifyTransferRepository(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, oldOwnerName string)
2525
NotifyNewIssue(ctx context.Context, issue *issues_model.Issue, mentions []*user_model.User)
26-
NotifyIssueChangeStatus(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, actionComment *issues_model.Comment, closeOrReopen bool)
26+
NotifyIssueChangeStatus(ctx context.Context, doer *user_model.User, commitID string, issue *issues_model.Issue, actionComment *issues_model.Comment, closeOrReopen bool)
2727
NotifyDeleteIssue(ctx context.Context, doer *user_model.User, issue *issues_model.Issue)
2828
NotifyIssueChangeMilestone(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, oldMilestoneID int64)
2929
NotifyIssueChangeAssignee(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, assignee *user_model.User, removed bool, comment *issues_model.Comment)

modules/notification/base/null.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func (*NullNotifier) NotifyNewIssue(ctx context.Context, issue *issues_model.Iss
3232
}
3333

3434
// NotifyIssueChangeStatus places a place holder function
35-
func (*NullNotifier) NotifyIssueChangeStatus(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, actionComment *issues_model.Comment, isClosed bool) {
35+
func (*NullNotifier) NotifyIssueChangeStatus(ctx context.Context, doer *user_model.User, commitID string, issue *issues_model.Issue, actionComment *issues_model.Comment, isClosed bool) {
3636
}
3737

3838
// NotifyDeleteIssue notify when some issue deleted

modules/notification/mail/mail.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func (m *mailNotifier) NotifyNewIssue(ctx context.Context, issue *issues_model.I
5454
}
5555
}
5656

57-
func (m *mailNotifier) NotifyIssueChangeStatus(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, actionComment *issues_model.Comment, isClosed bool) {
57+
func (m *mailNotifier) NotifyIssueChangeStatus(ctx context.Context, doer *user_model.User, commitID string, issue *issues_model.Issue, actionComment *issues_model.Comment, isClosed bool) {
5858
var actionType activities_model.ActionType
5959
if issue.IsPull {
6060
if isClosed {

modules/notification/notification.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ func NotifyNewIssue(ctx context.Context, issue *issues_model.Issue, mentions []*
7777
}
7878

7979
// NotifyIssueChangeStatus notifies close or reopen issue to notifiers
80-
func NotifyIssueChangeStatus(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, actionComment *issues_model.Comment, closeOrReopen bool) {
80+
func NotifyIssueChangeStatus(ctx context.Context, doer *user_model.User, commitID string, issue *issues_model.Issue, actionComment *issues_model.Comment, closeOrReopen bool) {
8181
for _, notifier := range notifiers {
82-
notifier.NotifyIssueChangeStatus(ctx, doer, issue, actionComment, closeOrReopen)
82+
notifier.NotifyIssueChangeStatus(ctx, doer, commitID, issue, actionComment, closeOrReopen)
8383
}
8484
}
8585

modules/notification/ui/ui.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func (ns *notificationService) NotifyNewIssue(ctx context.Context, issue *issues
9393
}
9494
}
9595

96-
func (ns *notificationService) NotifyIssueChangeStatus(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, actionComment *issues_model.Comment, isClosed bool) {
96+
func (ns *notificationService) NotifyIssueChangeStatus(ctx context.Context, doer *user_model.User, commitID string, issue *issues_model.Issue, actionComment *issues_model.Comment, isClosed bool) {
9797
_ = ns.issueQueue.Push(issueNotificationOpts{
9898
IssueID: issue.ID,
9999
NotificationAuthorID: doer.ID,

modules/structs/hook.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ type IssuePayload struct {
352352
Issue *Issue `json:"issue"`
353353
Repository *Repository `json:"repository"`
354354
Sender *User `json:"sender"`
355+
CommitID string `json:"commit_id"`
355356
}
356357

357358
// JSONPayload encodes the IssuePayload to JSON, with an indentation of two spaces.
@@ -386,6 +387,7 @@ type PullRequestPayload struct {
386387
PullRequest *PullRequest `json:"pull_request"`
387388
Repository *Repository `json:"repository"`
388389
Sender *User `json:"sender"`
390+
CommitID string `json:"commit_id"`
389391
Review *ReviewPayload `json:"review"`
390392
}
391393

routers/api/v1/repo/issue.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ func CreateIssue(ctx *context.APIContext) {
654654
}
655655

656656
if form.Closed {
657-
if err := issue_service.ChangeStatus(issue, ctx.Doer, true); err != nil {
657+
if err := issue_service.ChangeStatus(issue, ctx.Doer, "", true); err != nil {
658658
if issues_model.IsErrDependenciesLeft(err) {
659659
ctx.Error(http.StatusPreconditionFailed, "DependenciesLeft", "cannot close this issue because it still has open dependencies")
660660
return
@@ -826,7 +826,7 @@ func EditIssue(ctx *context.APIContext) {
826826
}
827827

828828
if statusChangeComment != nil {
829-
notification.NotifyIssueChangeStatus(ctx, ctx.Doer, issue, statusChangeComment, issue.IsClosed)
829+
notification.NotifyIssueChangeStatus(ctx, ctx.Doer, "", issue, statusChangeComment, issue.IsClosed)
830830
}
831831

832832
// Refetch from database to assign some automatic values

routers/api/v1/repo/pull.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ func EditPullRequest(ctx *context.APIContext) {
600600
}
601601

602602
if statusChangeComment != nil {
603-
notification.NotifyIssueChangeStatus(ctx, ctx.Doer, issue, statusChangeComment, issue.IsClosed)
603+
notification.NotifyIssueChangeStatus(ctx, ctx.Doer, "", issue, statusChangeComment, issue.IsClosed)
604604
}
605605

606606
// change pull target branch

routers/private/mail.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func SendEmail(ctx *context.PrivateContext) {
8181

8282
func sendEmail(ctx *context.PrivateContext, subject, message string, to []string) {
8383
for _, email := range to {
84-
msg := mailer.NewMessage([]string{email}, subject, message)
84+
msg := mailer.NewMessage(email, subject, message)
8585
mailer.SendAsync(msg)
8686
}
8787

routers/web/auth/oauth.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -847,6 +847,11 @@ func SignInOAuth(ctx *context.Context) {
847847
return
848848
}
849849

850+
redirectTo := ctx.FormString("redirect_to")
851+
if len(redirectTo) > 0 {
852+
middleware.SetRedirectToCookie(ctx.Resp, redirectTo)
853+
}
854+
850855
// try to do a direct callback flow, so we don't authenticate the user again but use the valid accesstoken to get the user
851856
user, gothUser, err := oAuth2UserLoginCallback(authSource, ctx.Req, ctx.Resp)
852857
if err == nil && user != nil {

routers/web/repo/issue.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2599,7 +2599,7 @@ func UpdateIssueStatus(ctx *context.Context) {
25992599
}
26002600
for _, issue := range issues {
26012601
if issue.IsClosed != isClosed {
2602-
if err := issue_service.ChangeStatus(issue, ctx.Doer, isClosed); err != nil {
2602+
if err := issue_service.ChangeStatus(issue, ctx.Doer, "", isClosed); err != nil {
26032603
if issues_model.IsErrDependenciesLeft(err) {
26042604
ctx.JSON(http.StatusPreconditionFailed, map[string]interface{}{
26052605
"error": "cannot close this issue because it still has open dependencies",
@@ -2696,7 +2696,7 @@ func NewComment(ctx *context.Context) {
26962696
ctx.Flash.Info(ctx.Tr("repo.pulls.open_unmerged_pull_exists", pr.Index))
26972697
} else {
26982698
isClosed := form.Status == "close"
2699-
if err := issue_service.ChangeStatus(issue, ctx.Doer, isClosed); err != nil {
2699+
if err := issue_service.ChangeStatus(issue, ctx.Doer, "", isClosed); err != nil {
27002700
log.Error("ChangeStatus: %v", err)
27012701

27022702
if issues_model.IsErrDependenciesLeft(err) {

services/issue/commit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ func UpdateIssuesCommit(doer *user_model.User, repo *repo_model.Repository, comm
193193
}
194194
if close != refIssue.IsClosed {
195195
refIssue.Repo = refRepo
196-
if err := ChangeStatus(refIssue, doer, close); err != nil {
196+
if err := ChangeStatus(refIssue, doer, c.Sha1, close); err != nil {
197197
return err
198198
}
199199
}

services/issue/status.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ import (
1414
)
1515

1616
// ChangeStatus changes issue status to open or closed.
17-
func ChangeStatus(issue *issues_model.Issue, doer *user_model.User, closed bool) error {
18-
return changeStatusCtx(db.DefaultContext, issue, doer, closed)
17+
func ChangeStatus(issue *issues_model.Issue, doer *user_model.User, commitID string, closed bool) error {
18+
return changeStatusCtx(db.DefaultContext, issue, doer, commitID, closed)
1919
}
2020

2121
// changeStatusCtx changes issue status to open or closed.
2222
// TODO: if context is not db.DefaultContext we get a deadlock!!!
23-
func changeStatusCtx(ctx context.Context, issue *issues_model.Issue, doer *user_model.User, closed bool) error {
23+
func changeStatusCtx(ctx context.Context, issue *issues_model.Issue, doer *user_model.User, commitID string, closed bool) error {
2424
comment, err := issues_model.ChangeIssueStatus(ctx, issue, doer, closed)
2525
if err != nil {
2626
if issues_model.IsErrDependenciesLeft(err) && closed {
@@ -37,7 +37,7 @@ func changeStatusCtx(ctx context.Context, issue *issues_model.Issue, doer *user_
3737
}
3838
}
3939

40-
notification.NotifyIssueChangeStatus(ctx, doer, issue, comment, closed)
40+
notification.NotifyIssueChangeStatus(ctx, doer, commitID, issue, comment, closed)
4141

4242
return nil
4343
}

services/mailer/mail.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func SendTestMail(email string) error {
6161
// No mail service configured
6262
return nil
6363
}
64-
return gomail.Send(Sender, NewMessage([]string{email}, "Gitea Test Email!", "Gitea Test Email!").ToMessage())
64+
return gomail.Send(Sender, NewMessage(email, "Gitea Test Email!", "Gitea Test Email!").ToMessage())
6565
}
6666

6767
// sendUserMail sends a mail to the user
@@ -86,7 +86,7 @@ func sendUserMail(language string, u *user_model.User, tpl base.TplName, code, s
8686
return
8787
}
8888

89-
msg := NewMessage([]string{u.Email}, subject, content.String())
89+
msg := NewMessage(u.Email, subject, content.String())
9090
msg.Info = fmt.Sprintf("UID: %d, %s", u.ID, info)
9191

9292
SendAsync(msg)
@@ -137,7 +137,7 @@ func SendActivateEmailMail(u *user_model.User, email *user_model.EmailAddress) {
137137
return
138138
}
139139

140-
msg := NewMessage([]string{email.Email}, locale.Tr("mail.activate_email"), content.String())
140+
msg := NewMessage(email.Email, locale.Tr("mail.activate_email"), content.String())
141141
msg.Info = fmt.Sprintf("UID: %d, activate email", u.ID)
142142

143143
SendAsync(msg)
@@ -168,7 +168,7 @@ func SendRegisterNotifyMail(u *user_model.User) {
168168
return
169169
}
170170

171-
msg := NewMessage([]string{u.Email}, locale.Tr("mail.register_notify"), content.String())
171+
msg := NewMessage(u.Email, locale.Tr("mail.register_notify"), content.String())
172172
msg.Info = fmt.Sprintf("UID: %d, registration notify", u.ID)
173173

174174
SendAsync(msg)
@@ -202,7 +202,7 @@ func SendCollaboratorMail(u, doer *user_model.User, repo *repo_model.Repository)
202202
return
203203
}
204204

205-
msg := NewMessage([]string{u.Email}, subject, content.String())
205+
msg := NewMessage(u.Email, subject, content.String())
206206
msg.Info = fmt.Sprintf("UID: %d, add collaborator", u.ID)
207207

208208
SendAsync(msg)
@@ -322,7 +322,7 @@ func composeIssueCommentMessages(ctx *mailCommentContext, lang string, recipient
322322

323323
msgs := make([]*Message, 0, len(recipients))
324324
for _, recipient := range recipients {
325-
msg := NewMessageFrom([]string{recipient.Email}, ctx.Doer.DisplayName(), setting.MailService.FromEmail, subject, mailBody.String())
325+
msg := NewMessageFrom(recipient.Email, ctx.Doer.DisplayName(), setting.MailService.FromEmail, subject, mailBody.String())
326326
msg.Info = fmt.Sprintf("Subject: %s, %s", subject, info)
327327

328328
msg.SetHeader("Message-ID", msgID)

services/mailer/mail_release.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func mailNewRelease(ctx context.Context, lang string, tos []string, rel *repo_mo
8989
publisherName := rel.Publisher.DisplayName()
9090
relURL := "<" + rel.HTMLURL() + ">"
9191
for _, to := range tos {
92-
msg := NewMessageFrom([]string{to}, publisherName, setting.MailService.FromEmail, subject, mailBody.String())
92+
msg := NewMessageFrom(to, publisherName, setting.MailService.FromEmail, subject, mailBody.String())
9393
msg.Info = subject
9494
msg.SetHeader("Message-ID", relURL)
9595
msgs = append(msgs, msg)

services/mailer/mail_repo.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,12 @@ func sendRepoTransferNotifyMailPerLang(lang string, newOwner, doer *user_model.U
8282
return err
8383
}
8484

85-
msg := NewMessage(emails, subject, content.String())
86-
msg.Info = fmt.Sprintf("UID: %d, repository pending transfer notification", newOwner.ID)
85+
for _, to := range emails {
86+
msg := NewMessage(to, subject, content.String())
87+
msg.Info = fmt.Sprintf("UID: %d, repository pending transfer notification", newOwner.ID)
88+
89+
SendAsync(msg)
90+
}
8791

88-
SendAsync(msg)
8992
return nil
9093
}

0 commit comments

Comments
 (0)