enhancement: add signoff option in commit form (#14516)

Signed-off-by: a1012112796 <1012112796@qq.com>
This commit is contained in:
a1012112796 2021-01-29 16:57:45 +08:00 committed by GitHub
parent f761c82c94
commit f19da14c34
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 51 additions and 8 deletions

View file

@ -235,6 +235,7 @@ func CreateFile(ctx *context.APIContext) {
Author: apiOpts.Dates.Author,
Committer: apiOpts.Dates.Committer,
},
Signoff: apiOpts.Signoff,
}
if opts.Dates.Author.IsZero() {
opts.Dates.Author = time.Now()
@ -323,6 +324,7 @@ func UpdateFile(ctx *context.APIContext) {
Author: apiOpts.Dates.Author,
Committer: apiOpts.Dates.Committer,
},
Signoff: apiOpts.Signoff,
}
if opts.Dates.Author.IsZero() {
opts.Dates.Author = time.Now()
@ -449,6 +451,7 @@ func DeleteFile(ctx *context.APIContext) {
Author: apiOpts.Dates.Author,
Committer: apiOpts.Dates.Committer,
},
Signoff: apiOpts.Signoff,
}
if opts.Dates.Author.IsZero() {
opts.Dates.Author = time.Now()

View file

@ -240,6 +240,7 @@ func editFilePost(ctx *context.Context, form auth.EditRepoFileForm, isNewFile bo
Message: message,
Content: strings.ReplaceAll(form.Content, "\r", ""),
IsNewFile: isNewFile,
Signoff: form.Signoff,
}); err != nil {
// This is where we handle all the errors thrown by repofiles.CreateOrUpdateRepoFile
if git.IsErrNotExist(err) {
@ -442,6 +443,7 @@ func DeleteFilePost(ctx *context.Context) {
NewBranch: branchName,
TreePath: ctx.Repo.TreePath,
Message: message,
Signoff: form.Signoff,
}); err != nil {
// This is where we handle all the errors thrown by repofiles.DeleteRepoFile
if git.IsErrNotExist(err) || models.IsErrRepoFileDoesNotExist(err) {
@ -650,6 +652,7 @@ func UploadFilePost(ctx *context.Context) {
TreePath: form.TreePath,
Message: message,
Files: form.Files,
Signoff: form.Signoff,
}); err != nil {
if models.IsErrLFSFileLocked(err) {
ctx.Data["Err_TreePath"] = true