mirror of
https://github.com/go-gitea/gitea
synced 2025-07-23 02:38:35 +00:00
[Refactor] Move APIFormat functions into convert package (#12856)
* USER APIFormat -> ToUser * Migrate more and mark APIFormat deprecated * models.Comment APIFormat() -> convert.ToComment * models.Release APIFormat() -> convert.ToRelease * models.Attachments APIFormat() -> convert.ToReleaseAttachments * models.CommitStatus APIFormat() -> convert.ToCommitStatus * finish migration to convert.ToUser * Move Test * Imprufe Test * fix test Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
@@ -31,7 +31,7 @@ func ToAPIIssue(issue *models.Issue) *api.Issue {
|
||||
URL: issue.APIURL(),
|
||||
HTMLURL: issue.HTMLURL(),
|
||||
Index: issue.Index,
|
||||
Poster: issue.Poster.APIFormat(),
|
||||
Poster: ToUser(issue.Poster, false, false),
|
||||
Title: issue.Title,
|
||||
Body: issue.Content,
|
||||
Labels: ToLabelList(issue.Labels),
|
||||
@@ -65,9 +65,9 @@ func ToAPIIssue(issue *models.Issue) *api.Issue {
|
||||
}
|
||||
if len(issue.Assignees) > 0 {
|
||||
for _, assignee := range issue.Assignees {
|
||||
apiIssue.Assignees = append(apiIssue.Assignees, assignee.APIFormat())
|
||||
apiIssue.Assignees = append(apiIssue.Assignees, ToUser(assignee, false, false))
|
||||
}
|
||||
apiIssue.Assignee = issue.Assignees[0].APIFormat() // For compatibility, we're keeping the first assignee as `apiIssue.Assignee`
|
||||
apiIssue.Assignee = ToUser(issue.Assignees[0], false, false) // For compatibility, we're keeping the first assignee as `apiIssue.Assignee`
|
||||
}
|
||||
if issue.IsPull {
|
||||
if err := issue.LoadPullRequest(); err != nil {
|
||||
|
Reference in New Issue
Block a user