Kaynağa Gözat

when the update request doesn't intend to update attachments (eg: change checkbox state), ignore attachment updates (#16762)

tags/v1.16.0-rc1
wxiaoguang 2 yıl önce
ebeveyn
işleme
06f82641cb
No account linked to committer's email address
1 değiştirilmiş dosya ile 12 ekleme ve 10 silme
  1. 12
    10
      routers/web/repo/issue.go

+ 12
- 10
routers/web/repo/issue.go Dosyayı Görüntüle

@@ -1727,9 +1727,12 @@ func UpdateIssueContent(ctx *context.Context) {
return
}

if err := updateAttachments(issue, ctx.FormStrings("files[]")); err != nil {
ctx.ServerError("UpdateAttachments", err)
return
// when update the request doesn't intend to update attachments (eg: change checkbox state), ignore attachment updates
if !ctx.FormBool("ignore_attachments") {
if err := updateAttachments(issue, ctx.FormStrings("files[]")); err != nil {
ctx.ServerError("UpdateAttachments", err)
return
}
}

content, err := markdown.RenderString(&markup.RenderContext{
@@ -2148,10 +2151,6 @@ func UpdateCommentContent(ctx *context.Context) {
return
}

if ctx.FormBool("ignore_attachments") {
return
}

if comment.Type == models.CommentTypeComment {
if err := comment.LoadAttachments(); err != nil {
ctx.ServerError("LoadAttachments", err)
@@ -2159,9 +2158,12 @@ func UpdateCommentContent(ctx *context.Context) {
}
}

if err := updateAttachments(comment, ctx.FormStrings("files[]")); err != nil {
ctx.ServerError("UpdateAttachments", err)
return
// when the update request doesn't intend to update attachments (eg: change checkbox state), ignore attachment updates
if !ctx.FormBool("ignore_attachments") {
if err := updateAttachments(comment, ctx.FormStrings("files[]")); err != nil {
ctx.ServerError("UpdateAttachments", err)
return
}
}

content, err := markdown.RenderString(&markup.RenderContext{

Loading…
İptal
Kaydet