1
0
Fork 0
forked from forgejo/forgejo

[refactor] Unify the export of user data via API (#15144)

* [refactor] unify how user data is exported via API

* test time via unix timestamp
This commit is contained in:
6543 2021-03-27 17:45:26 +01:00 committed by GitHub
parent f4d27498bd
commit 290cf75f93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 117 additions and 97 deletions

View file

@ -86,13 +86,13 @@ func ToCommit(repo *models.Repository, commit *git.Commit, userCache map[string]
}
if ok {
apiAuthor = ToUser(cacheAuthor, false, false)
apiAuthor = ToUser(cacheAuthor, nil)
} else {
author, err := models.GetUserByEmail(commit.Author.Email)
if err != nil && !models.IsErrUserNotExist(err) {
return nil, err
} else if err == nil {
apiAuthor = ToUser(author, false, false)
apiAuthor = ToUser(author, nil)
if userCache != nil {
userCache[commit.Author.Email] = author
}
@ -108,13 +108,13 @@ func ToCommit(repo *models.Repository, commit *git.Commit, userCache map[string]
}
if ok {
apiCommitter = ToUser(cacheCommitter, false, false)
apiCommitter = ToUser(cacheCommitter, nil)
} else {
committer, err := models.GetUserByEmail(commit.Committer.Email)
if err != nil && !models.IsErrUserNotExist(err) {
return nil, err
} else if err == nil {
apiCommitter = ToUser(committer, false, false)
apiCommitter = ToUser(committer, nil)
if userCache != nil {
userCache[commit.Committer.Email] = committer
}