mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
[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:
@@ -20,14 +20,9 @@ func ToPullReview(r *models.Review, doer *models.User) (*api.PullReview, error)
|
||||
r.Reviewer = models.NewGhostUser()
|
||||
}
|
||||
|
||||
auth := false
|
||||
if doer != nil {
|
||||
auth = doer.IsAdmin || doer.ID == r.ReviewerID
|
||||
}
|
||||
|
||||
result := &api.PullReview{
|
||||
ID: r.ID,
|
||||
Reviewer: ToUser(r.Reviewer, doer != nil, auth),
|
||||
Reviewer: ToUser(r.Reviewer, doer),
|
||||
ReviewerTeam: ToTeam(r.ReviewerTeam),
|
||||
State: api.ReviewStateUnknown,
|
||||
Body: r.Content,
|
||||
@@ -88,14 +83,10 @@ func ToPullReviewCommentList(review *models.Review, doer *models.User) ([]*api.P
|
||||
for _, lines := range review.CodeComments {
|
||||
for _, comments := range lines {
|
||||
for _, comment := range comments {
|
||||
auth := false
|
||||
if doer != nil {
|
||||
auth = doer.IsAdmin || doer.ID == comment.Poster.ID
|
||||
}
|
||||
apiComment := &api.PullReviewComment{
|
||||
ID: comment.ID,
|
||||
Body: comment.Content,
|
||||
Reviewer: ToUser(comment.Poster, doer != nil, auth),
|
||||
Reviewer: ToUser(comment.Poster, doer),
|
||||
ReviewID: review.ID,
|
||||
Created: comment.CreatedUnix.AsTime(),
|
||||
Updated: comment.UpdatedUnix.AsTime(),
|
||||
|
Reference in New Issue
Block a user