Skip to content

Commit d0ff33f

Browse files
committed
Improvements
1 parent bb1657a commit d0ff33f

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

routers/api/v1/repo/issue_comment.go

+10-13
Original file line numberDiff line numberDiff line change
@@ -609,20 +609,17 @@ func editIssueComment(ctx *context.APIContext, form api.EditIssueCommentOption)
609609
return
610610
}
611611

612-
oldContent := comment.Content
613-
if form.Body == oldContent {
614-
ctx.JSON(http.StatusOK, convert.ToAPIComment(ctx, ctx.Repo.Repository, comment))
615-
return
616-
}
617-
618-
comment.Content = form.Body
619-
if err := issue_service.UpdateComment(ctx, comment, comment.ContentVersion, ctx.Doer, oldContent); err != nil {
620-
if errors.Is(err, user_model.ErrBlockedUser) {
621-
ctx.APIError(http.StatusForbidden, err)
622-
} else {
623-
ctx.APIErrorInternal(err)
612+
if form.Body != comment.Content {
613+
oldContent := comment.Content
614+
comment.Content = form.Body
615+
if err := issue_service.UpdateComment(ctx, comment, comment.ContentVersion, ctx.Doer, oldContent); err != nil {
616+
if errors.Is(err, user_model.ErrBlockedUser) {
617+
ctx.APIError(http.StatusForbidden, err)
618+
} else {
619+
ctx.APIErrorInternal(err)
620+
}
621+
return
624622
}
625-
return
626623
}
627624

628625
ctx.JSON(http.StatusOK, convert.ToAPIComment(ctx, ctx.Repo.Repository, comment))

0 commit comments

Comments
 (0)