1
0
Fork 0
forked from forgejo/forgejo

For API attachments, use API URL (#25639) (#25814)

Backport #25639 by @lunny

Fix #25257

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
Giteabot 2023-07-10 08:56:16 -04:00 committed by GitHub
parent b4460cf541
commit 2b79d3fd52
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 108 additions and 67 deletions

View file

@ -103,7 +103,7 @@ func ListIssueComments(ctx *context.APIContext) {
apiComments := make([]*api.Comment, len(comments))
for i, comment := range comments {
comment.Issue = issue
apiComments[i] = convert.ToComment(ctx, comments[i])
apiComments[i] = convert.ToAPIComment(ctx, ctx.Repo.Repository, comments[i])
}
ctx.SetTotalCountHeader(totalCount)
@ -191,7 +191,7 @@ func ListIssueCommentsAndTimeline(ctx *context.APIContext) {
for _, comment := range comments {
if comment.Type != issues_model.CommentTypeCode && isXRefCommentAccessible(ctx, ctx.Doer, comment, issue.RepoID) {
comment.Issue = issue
apiComments = append(apiComments, convert.ToTimelineComment(ctx, comment, ctx.Doer))
apiComments = append(apiComments, convert.ToTimelineComment(ctx, issue.Repo, comment, ctx.Doer))
}
}
@ -308,7 +308,7 @@ func ListRepoIssueComments(ctx *context.APIContext) {
return
}
for i := range comments {
apiComments[i] = convert.ToComment(ctx, comments[i])
apiComments[i] = convert.ToAPIComment(ctx, ctx.Repo.Repository, comments[i])
}
ctx.SetTotalCountHeader(totalCount)
@ -368,7 +368,7 @@ func CreateIssueComment(ctx *context.APIContext) {
return
}
ctx.JSON(http.StatusCreated, convert.ToComment(ctx, comment))
ctx.JSON(http.StatusCreated, convert.ToAPIComment(ctx, ctx.Repo.Repository, comment))
}
// GetIssueComment Get a comment by ID
@ -436,7 +436,7 @@ func GetIssueComment(ctx *context.APIContext) {
return
}
ctx.JSON(http.StatusOK, convert.ToComment(ctx, comment))
ctx.JSON(http.StatusOK, convert.ToAPIComment(ctx, ctx.Repo.Repository, comment))
}
// EditIssueComment modify a comment of an issue
@ -561,7 +561,7 @@ func editIssueComment(ctx *context.APIContext, form api.EditIssueCommentOption)
return
}
ctx.JSON(http.StatusOK, convert.ToComment(ctx, comment))
ctx.JSON(http.StatusOK, convert.ToAPIComment(ctx, ctx.Repo.Repository, comment))
}
// DeleteIssueComment delete a comment from an issue