Improvements

This commit is contained in:
Lunny Xiao 2025-05-09 22:15:21 -07:00
parent bb1657a6e2
commit d0ff33f007

View File

@ -609,20 +609,17 @@ func editIssueComment(ctx *context.APIContext, form api.EditIssueCommentOption)
return return
} }
oldContent := comment.Content if form.Body != comment.Content {
if form.Body == oldContent { oldContent := comment.Content
ctx.JSON(http.StatusOK, convert.ToAPIComment(ctx, ctx.Repo.Repository, comment)) comment.Content = form.Body
return if err := issue_service.UpdateComment(ctx, comment, comment.ContentVersion, ctx.Doer, oldContent); err != nil {
} if errors.Is(err, user_model.ErrBlockedUser) {
ctx.APIError(http.StatusForbidden, err)
comment.Content = form.Body } else {
if err := issue_service.UpdateComment(ctx, comment, comment.ContentVersion, ctx.Doer, oldContent); err != nil { ctx.APIErrorInternal(err)
if errors.Is(err, user_model.ErrBlockedUser) { }
ctx.APIError(http.StatusForbidden, err) return
} else {
ctx.APIErrorInternal(err)
} }
return
} }
ctx.JSON(http.StatusOK, convert.ToAPIComment(ctx, ctx.Repo.Repository, comment)) ctx.JSON(http.StatusOK, convert.ToAPIComment(ctx, ctx.Repo.Repository, comment))