diff options
author | 6543 <6543@obermui.de> | 2020-10-17 06:23:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-17 00:23:08 -0400 |
commit | d453533beb197d25b25530dc5f0e3c3c0742d8d1 (patch) | |
tree | 6d66e1163333344d91af63e9ab50a82367470b8f /routers/repo/issue.go | |
parent | 131278ff222f1a8580f20e6bbdff405341403042 (diff) | |
download | gitea-d453533beb197d25b25530dc5f0e3c3c0742d8d1.tar.gz gitea-d453533beb197d25b25530dc5f0e3c3c0742d8d1.zip |
[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>
Diffstat (limited to 'routers/repo/issue.go')
-rw-r--r-- | routers/repo/issue.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 8aef322090..bc65e73f11 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -19,6 +19,7 @@ import ( "code.gitea.io/gitea/modules/auth" "code.gitea.io/gitea/modules/base" "code.gitea.io/gitea/modules/context" + "code.gitea.io/gitea/modules/convert" "code.gitea.io/gitea/modules/git" issue_indexer "code.gitea.io/gitea/modules/indexer/issues" "code.gitea.io/gitea/modules/log" @@ -2453,7 +2454,7 @@ func GetIssueAttachments(ctx *context.Context) { issue := GetActionIssue(ctx) var attachments = make([]*api.Attachment, len(issue.Attachments)) for i := 0; i < len(issue.Attachments); i++ { - attachments[i] = issue.Attachments[i].APIFormat() + attachments[i] = convert.ToReleaseAttachment(issue.Attachments[i]) } ctx.JSON(200, attachments) } @@ -2472,7 +2473,7 @@ func GetCommentAttachments(ctx *context.Context) { return } for i := 0; i < len(comment.Attachments); i++ { - attachments = append(attachments, comment.Attachments[i].APIFormat()) + attachments = append(attachments, convert.ToReleaseAttachment(comment.Attachments[i])) } } ctx.JSON(200, attachments) |