Skip to content

Commit

Permalink
Merge branch 'main' into dependency-link-rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
techknowlogick authored Aug 20, 2021
2 parents 04a39bc + dc26136 commit 1c4fa1e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
18 changes: 11 additions & 7 deletions routers/web/repo/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -2127,13 +2127,6 @@ func UpdateCommentContent(ctx *context.Context) {
return
}

if comment.Type == models.CommentTypeComment {
if err := comment.LoadAttachments(); err != nil {
ctx.ServerError("LoadAttachments", err)
return
}
}

if !ctx.IsSigned || (ctx.User.ID != comment.PosterID && !ctx.Repo.CanWriteIssuesOrPulls(comment.Issue.IsPull)) {
ctx.Error(http.StatusForbidden)
return
Expand All @@ -2155,6 +2148,17 @@ 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)
return
}
}

if err := updateAttachments(comment, ctx.FormStrings("files[]")); err != nil {
ctx.ServerError("UpdateAttachments", err)
return
Expand Down
3 changes: 2 additions & 1 deletion web_src/js/markup/tasklist.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ export function initMarkupTasklist() {
const {updateUrl, context} = editContentZone.dataset;

await $.post(updateUrl, {
ignore_attachments: true,
_csrf: window.config.csrf,
content: newContent,
context,
context
});

rawContent.textContent = newContent;
Expand Down

0 comments on commit 1c4fa1e

Please sign in to comment.