Skip to content

Commit f11df80

Browse files
6543lunny
authored andcommitted
File Edit: Author/Committer interchanged [BugFix] (#9300)
1 parent 59913f4 commit f11df80

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

integrations/api_repo_file_create_test.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ func getCreateFileOptions() api.CreateFileOptions {
3030
NewBranchName: "master",
3131
Message: "Making this new file new/file.txt",
3232
Author: api.Identity{
33-
Name: "John Doe",
34-
Email: "johndoe@example.com",
33+
Name: "Anne Doe",
34+
Email: "annedoe@example.com",
3535
},
3636
Committer: api.Identity{
37-
Name: "Jane Doe",
38-
Email: "janedoe@example.com",
37+
Name: "John Doe",
38+
Email: "johndoe@example.com",
3939
},
4040
},
4141
Content: contentEncoded,
@@ -77,8 +77,8 @@ func getExpectedFileResponseForCreate(commitID, treePath string) *api.FileRespon
7777
HTMLURL: setting.AppURL + "user2/repo1/commit/" + commitID,
7878
Author: &api.CommitUser{
7979
Identity: api.Identity{
80-
Name: "Jane Doe",
81-
Email: "janedoe@example.com",
80+
Name: "Anne Doe",
81+
Email: "annedoe@example.com",
8282
},
8383
},
8484
Committer: &api.CommitUser{

integrations/api_repo_file_update_test.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ func getUpdateFileOptions() *api.UpdateFileOptions {
3535
3636
},
3737
Committer: api.Identity{
38-
Name: "Jane Doe",
39-
Email: "janedoe@example.com",
38+
Name: "Anne Doe",
39+
Email: "annedoe@example.com",
4040
},
4141
},
4242
SHA: "103ff9234cefeee5ec5361d22b49fbb04d385885",
@@ -80,14 +80,14 @@ func getExpectedFileResponseForUpdate(commitID, treePath string) *api.FileRespon
8080
HTMLURL: setting.AppURL + "user2/repo1/commit/" + commitID,
8181
Author: &api.CommitUser{
8282
Identity: api.Identity{
83-
Name: "Jane Doe",
84-
Email: "janedoe@example.com",
83+
Name: "John Doe",
84+
Email: "johndoe@example.com",
8585
},
8686
},
8787
Committer: &api.CommitUser{
8888
Identity: api.Identity{
89-
Name: "John Doe",
90-
Email: "johndoe@example.com",
89+
Name: "Anne Doe",
90+
Email: "annedoe@example.com",
9191
},
9292
},
9393
Message: "My update of README.md\n",

modules/repofiles/delete.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func DeleteRepoFile(repo *models.Repository, doer *models.User, opts *DeleteRepo
6969

7070
message := strings.TrimSpace(opts.Message)
7171

72-
author, committer := GetAuthorAndCommitterUsers(opts.Committer, opts.Author, doer)
72+
author, committer := GetAuthorAndCommitterUsers(opts.Author, opts.Committer, doer)
7373

7474
t, err := NewTemporaryUploadRepository(repo)
7575
if err != nil {

modules/repofiles/file.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func GetFileCommitResponse(repo *models.Repository, commit *git.Commit) (*api.Fi
8080
}
8181

8282
// GetAuthorAndCommitterUsers Gets the author and committer user objects from the IdentityOptions
83-
func GetAuthorAndCommitterUsers(author, committer *IdentityOptions, doer *models.User) (committerUser, authorUser *models.User) {
83+
func GetAuthorAndCommitterUsers(author, committer *IdentityOptions, doer *models.User) (authorUser, committerUser *models.User) {
8484
// Committer and author are optional. If they are not the doer (not same email address)
8585
// then we use bogus User objects for them to store their FullName and Email.
8686
// If only one of the two are provided, we set both of them to it.

modules/repofiles/update.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ func CreateOrUpdateRepoFile(repo *models.Repository, doer *models.User, opts *Up
167167

168168
message := strings.TrimSpace(opts.Message)
169169

170-
author, committer := GetAuthorAndCommitterUsers(opts.Committer, opts.Author, doer)
170+
author, committer := GetAuthorAndCommitterUsers(opts.Author, opts.Committer, doer)
171171

172172
t, err := NewTemporaryUploadRepository(repo)
173173
if err != nil {

0 commit comments

Comments
 (0)