Skip to content

Commit f07447b

Browse files
authored
Merge branch 'main' into strictopts
2 parents 7c0f18f + 75940a0 commit f07447b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1001
-273
lines changed

models/user/email_address.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,3 +542,13 @@ func IsEmailDomainAllowed(email string) bool {
542542

543543
return validation.IsEmailDomainListed(setting.Service.EmailDomainAllowList, email)
544544
}
545+
546+
func GetActivatedEmailAddresses(ctx context.Context, uid int64) ([]string, error) {
547+
emails := make([]string, 0, 2)
548+
if err := db.GetEngine(ctx).Table("email_address").Select("email").
549+
Where("uid=? AND is_activated=?", uid, true).Asc("id").
550+
Find(&emails); err != nil {
551+
return nil, err
552+
}
553+
return emails, nil
554+
}

models/user/user.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ func (u *User) GetPlaceholderEmail() string {
214214
return fmt.Sprintf("%s@%s", u.LowerName, setting.Service.NoReplyAddress)
215215
}
216216

217-
// GetEmail returns an noreply email, if the user has set to keep his
217+
// GetEmail returns a noreply email, if the user has set to keep his
218218
// email address private, otherwise the primary email address.
219219
func (u *User) GetEmail() string {
220220
if u.KeepEmailPrivate {

modules/git/commit_submodule_file.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ func (sf *CommitSubmoduleFile) SubmoduleWebLink(ctx context.Context, optCommitID
4646
if len(optCommitID) == 2 {
4747
commitLink = sf.repoLink + "/compare/" + optCommitID[0] + "..." + optCommitID[1]
4848
} else if len(optCommitID) == 1 {
49-
commitLink = sf.repoLink + "/commit/" + optCommitID[0]
49+
commitLink = sf.repoLink + "/tree/" + optCommitID[0]
5050
} else {
51-
commitLink = sf.repoLink + "/commit/" + sf.refID
51+
commitLink = sf.repoLink + "/tree/" + sf.refID
5252
}
5353
return &SubmoduleWebLink{RepoWebLink: sf.repoLink, CommitWebLink: commitLink}
5454
}

modules/git/commit_submodule_file_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ func TestCommitSubmoduleLink(t *testing.T) {
1515

1616
wl := sf.SubmoduleWebLink(context.Background())
1717
assert.Equal(t, "https://github.com/user/repo", wl.RepoWebLink)
18-
assert.Equal(t, "https://github.com/user/repo/commit/aaaa", wl.CommitWebLink)
18+
assert.Equal(t, "https://github.com/user/repo/tree/aaaa", wl.CommitWebLink)
1919

2020
wl = sf.SubmoduleWebLink(context.Background(), "1111")
2121
assert.Equal(t, "https://github.com/user/repo", wl.RepoWebLink)
22-
assert.Equal(t, "https://github.com/user/repo/commit/1111", wl.CommitWebLink)
22+
assert.Equal(t, "https://github.com/user/repo/tree/1111", wl.CommitWebLink)
2323

2424
wl = sf.SubmoduleWebLink(context.Background(), "1111", "2222")
2525
assert.Equal(t, "https://github.com/user/repo", wl.RepoWebLink)

modules/structs/hook.go

Lines changed: 2 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,7 @@ var (
116116
_ Payloader = &PackagePayload{}
117117
)
118118

119-
// _________ __
120-
// \_ ___ \_______ ____ _____ _/ |_ ____
121-
// / \ \/\_ __ \_/ __ \\__ \\ __\/ __ \
122-
// \ \____| | \/\ ___/ / __ \| | \ ___/
123-
// \______ /|__| \___ >____ /__| \___ >
124-
// \/ \/ \/ \/
125-
126-
// CreatePayload FIXME
119+
// CreatePayload represents a payload information of create event.
127120
type CreatePayload struct {
128121
Sha string `json:"sha"`
129122
Ref string `json:"ref"`
@@ -157,13 +150,6 @@ func ParseCreateHook(raw []byte) (*CreatePayload, error) {
157150
return hook, nil
158151
}
159152

160-
// ________ .__ __
161-
// \______ \ ____ | | _____/ |_ ____
162-
// | | \_/ __ \| | _/ __ \ __\/ __ \
163-
// | ` \ ___/| |_\ ___/| | \ ___/
164-
// /_______ /\___ >____/\___ >__| \___ >
165-
// \/ \/ \/ \/
166-
167153
// PusherType define the type to push
168154
type PusherType string
169155

@@ -186,13 +172,6 @@ func (p *DeletePayload) JSONPayload() ([]byte, error) {
186172
return json.MarshalIndent(p, "", " ")
187173
}
188174

189-
// ___________ __
190-
// \_ _____/__________| | __
191-
// | __)/ _ \_ __ \ |/ /
192-
// | \( <_> ) | \/ <
193-
// \___ / \____/|__| |__|_ \
194-
// \/ \/
195-
196175
// ForkPayload represents fork payload
197176
type ForkPayload struct {
198177
Forkee *Repository `json:"forkee"`
@@ -232,13 +211,6 @@ func (p *IssueCommentPayload) JSONPayload() ([]byte, error) {
232211
return json.MarshalIndent(p, "", " ")
233212
}
234213

235-
// __________ .__
236-
// \______ \ ____ | | ____ _____ ______ ____
237-
// | _// __ \| | _/ __ \\__ \ / ___// __ \
238-
// | | \ ___/| |_\ ___/ / __ \_\___ \\ ___/
239-
// |____|_ /\___ >____/\___ >____ /____ >\___ >
240-
// \/ \/ \/ \/ \/ \/
241-
242214
// HookReleaseAction defines hook release action type
243215
type HookReleaseAction string
244216

@@ -302,13 +274,6 @@ func (p *PushPayload) Branch() string {
302274
return strings.ReplaceAll(p.Ref, "refs/heads/", "")
303275
}
304276

305-
// .___
306-
// | | ______ ________ __ ____
307-
// | |/ ___// ___/ | \_/ __ \
308-
// | |\___ \ \___ \| | /\ ___/
309-
// |___/____ >____ >____/ \___ >
310-
// \/ \/ \/
311-
312277
// HookIssueAction FIXME
313278
type HookIssueAction string
314279

@@ -371,13 +336,6 @@ type ChangesPayload struct {
371336
Ref *ChangesFromPayload `json:"ref,omitempty"`
372337
}
373338

374-
// __________ .__ .__ __________ __
375-
// \______ \__ __| | | | \______ \ ____ ________ __ ____ _______/ |_
376-
// | ___/ | \ | | | | _// __ \/ ____/ | \_/ __ \ / ___/\ __\
377-
// | | | | / |_| |__ | | \ ___< <_| | | /\ ___/ \___ \ | |
378-
// |____| |____/|____/____/ |____|_ /\___ >__ |____/ \___ >____ > |__|
379-
// \/ \/ |__| \/ \/
380-
381339
// PullRequestPayload represents a payload information of pull request event.
382340
type PullRequestPayload struct {
383341
Action HookIssueAction `json:"action"`
@@ -402,13 +360,6 @@ type ReviewPayload struct {
402360
Content string `json:"content"`
403361
}
404362

405-
// __ __.__ __ .__
406-
// / \ / \__| | _|__|
407-
// \ \/\/ / | |/ / |
408-
// \ /| | <| |
409-
// \__/\ / |__|__|_ \__|
410-
// \/ \/
411-
412363
// HookWikiAction an action that happens to a wiki page
413364
type HookWikiAction string
414365

@@ -435,13 +386,6 @@ func (p *WikiPayload) JSONPayload() ([]byte, error) {
435386
return json.MarshalIndent(p, "", " ")
436387
}
437388

438-
//__________ .__ __
439-
//\______ \ ____ ______ ____ _____|__|/ |_ ___________ ___.__.
440-
// | _// __ \\____ \ / _ \/ ___/ \ __\/ _ \_ __ < | |
441-
// | | \ ___/| |_> > <_> )___ \| || | ( <_> ) | \/\___ |
442-
// |____|_ /\___ > __/ \____/____ >__||__| \____/|__| / ____|
443-
// \/ \/|__| \/ \/
444-
445389
// HookRepoAction an action that happens to a repo
446390
type HookRepoAction string
447391

@@ -480,7 +424,7 @@ type PackagePayload struct {
480424
Action HookPackageAction `json:"action"`
481425
Repository *Repository `json:"repository"`
482426
Package *Package `json:"package"`
483-
Organization *User `json:"organization"`
427+
Organization *Organization `json:"organization"`
484428
Sender *User `json:"sender"`
485429
}
486430

options/locale/locale_en-US.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,6 +1345,8 @@ editor.new_branch_name_desc = New branch name…
13451345
editor.cancel = Cancel
13461346
editor.filename_cannot_be_empty = The filename cannot be empty.
13471347
editor.filename_is_invalid = The filename is invalid: "%s".
1348+
editor.commit_email = Commit email
1349+
editor.invalid_commit_email = The email for the commit is invalid.
13481350
editor.branch_does_not_exist = Branch "%s" does not exist in this repository.
13491351
editor.branch_already_exists = Branch "%s" already exists in this repository.
13501352
editor.directory_is_a_file = Directory name "%s" is already used as a filename in this repository.

routers/api/v1/repo/file.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -489,12 +489,12 @@ func ChangeFiles(ctx *context.APIContext) {
489489
OldBranch: apiOpts.BranchName,
490490
NewBranch: apiOpts.NewBranchName,
491491
Committer: &files_service.IdentityOptions{
492-
Name: apiOpts.Committer.Name,
493-
Email: apiOpts.Committer.Email,
492+
GitUserName: apiOpts.Committer.Name,
493+
GitUserEmail: apiOpts.Committer.Email,
494494
},
495495
Author: &files_service.IdentityOptions{
496-
Name: apiOpts.Author.Name,
497-
Email: apiOpts.Author.Email,
496+
GitUserName: apiOpts.Author.Name,
497+
GitUserEmail: apiOpts.Author.Email,
498498
},
499499
Dates: &files_service.CommitDateOptions{
500500
Author: apiOpts.Dates.Author,
@@ -586,12 +586,12 @@ func CreateFile(ctx *context.APIContext) {
586586
OldBranch: apiOpts.BranchName,
587587
NewBranch: apiOpts.NewBranchName,
588588
Committer: &files_service.IdentityOptions{
589-
Name: apiOpts.Committer.Name,
590-
Email: apiOpts.Committer.Email,
589+
GitUserName: apiOpts.Committer.Name,
590+
GitUserEmail: apiOpts.Committer.Email,
591591
},
592592
Author: &files_service.IdentityOptions{
593-
Name: apiOpts.Author.Name,
594-
Email: apiOpts.Author.Email,
593+
GitUserName: apiOpts.Author.Name,
594+
GitUserEmail: apiOpts.Author.Email,
595595
},
596596
Dates: &files_service.CommitDateOptions{
597597
Author: apiOpts.Dates.Author,
@@ -689,12 +689,12 @@ func UpdateFile(ctx *context.APIContext) {
689689
OldBranch: apiOpts.BranchName,
690690
NewBranch: apiOpts.NewBranchName,
691691
Committer: &files_service.IdentityOptions{
692-
Name: apiOpts.Committer.Name,
693-
Email: apiOpts.Committer.Email,
692+
GitUserName: apiOpts.Committer.Name,
693+
GitUserEmail: apiOpts.Committer.Email,
694694
},
695695
Author: &files_service.IdentityOptions{
696-
Name: apiOpts.Author.Name,
697-
Email: apiOpts.Author.Email,
696+
GitUserName: apiOpts.Author.Name,
697+
GitUserEmail: apiOpts.Author.Email,
698698
},
699699
Dates: &files_service.CommitDateOptions{
700700
Author: apiOpts.Dates.Author,
@@ -848,12 +848,12 @@ func DeleteFile(ctx *context.APIContext) {
848848
OldBranch: apiOpts.BranchName,
849849
NewBranch: apiOpts.NewBranchName,
850850
Committer: &files_service.IdentityOptions{
851-
Name: apiOpts.Committer.Name,
852-
Email: apiOpts.Committer.Email,
851+
GitUserName: apiOpts.Committer.Name,
852+
GitUserEmail: apiOpts.Committer.Email,
853853
},
854854
Author: &files_service.IdentityOptions{
855-
Name: apiOpts.Author.Name,
856-
Email: apiOpts.Author.Email,
855+
GitUserName: apiOpts.Author.Name,
856+
GitUserEmail: apiOpts.Author.Email,
857857
},
858858
Dates: &files_service.CommitDateOptions{
859859
Author: apiOpts.Dates.Author,

routers/api/v1/repo/patch.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ func ApplyDiffPatch(ctx *context.APIContext) {
5858
OldBranch: apiOpts.BranchName,
5959
NewBranch: apiOpts.NewBranchName,
6060
Committer: &files.IdentityOptions{
61-
Name: apiOpts.Committer.Name,
62-
Email: apiOpts.Committer.Email,
61+
GitUserName: apiOpts.Committer.Name,
62+
GitUserEmail: apiOpts.Committer.Email,
6363
},
6464
Author: &files.IdentityOptions{
65-
Name: apiOpts.Author.Name,
66-
Email: apiOpts.Author.Email,
65+
GitUserName: apiOpts.Author.Name,
66+
GitUserEmail: apiOpts.Author.Email,
6767
},
6868
Dates: &files.CommitDateOptions{
6969
Author: apiOpts.Dates.Author,

routers/api/v1/utils/hook.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ func addHook(ctx *context.APIContext, form *api.CreateHookOption, ownerID, repoI
205205
webhook_module.HookEventWiki: util.SliceContainsString(form.Events, string(webhook_module.HookEventWiki), true),
206206
webhook_module.HookEventRepository: util.SliceContainsString(form.Events, string(webhook_module.HookEventRepository), true),
207207
webhook_module.HookEventRelease: util.SliceContainsString(form.Events, string(webhook_module.HookEventRelease), true),
208+
webhook_module.HookEventPackage: util.SliceContainsString(form.Events, string(webhook_module.HookEventPackage), true),
208209
webhook_module.HookEventStatus: util.SliceContainsString(form.Events, string(webhook_module.HookEventStatus), true),
209210
},
210211
BranchFilter: form.BranchFilter,
@@ -384,6 +385,7 @@ func editHook(ctx *context.APIContext, form *api.EditHookOption, w *webhook.Webh
384385
w.HookEvents[webhook_module.HookEventPullRequestAssign] = pullHook(form.Events, string(webhook_module.HookEventPullRequestAssign))
385386
w.HookEvents[webhook_module.HookEventPullRequestLabel] = pullHook(form.Events, string(webhook_module.HookEventPullRequestLabel))
386387
w.HookEvents[webhook_module.HookEventPullRequestMilestone] = pullHook(form.Events, string(webhook_module.HookEventPullRequestMilestone))
388+
w.HookEvents[webhook_module.HookEventPullRequestComment] = pullHook(form.Events, string(webhook_module.HookEventPullRequestComment))
387389
w.HookEvents[webhook_module.HookEventPullRequestReview] = pullHook(form.Events, "pull_request_review")
388390
w.HookEvents[webhook_module.HookEventPullRequestReviewRequest] = pullHook(form.Events, string(webhook_module.HookEventPullRequestReviewRequest))
389391
w.HookEvents[webhook_module.HookEventPullRequestSync] = pullHook(form.Events, string(webhook_module.HookEventPullRequestSync))

0 commit comments

Comments
 (0)