Skip to content

Commit ebf5fa4

Browse files
committed
Use tasklist flag.
1 parent 18b84b1 commit ebf5fa4

File tree

2 files changed

+14
-17
lines changed

2 files changed

+14
-17
lines changed

routers/web/repo/issue.go

+11-7
Original file line numberDiff line numberDiff line change
@@ -2127,13 +2127,6 @@ func UpdateCommentContent(ctx *context.Context) {
21272127
return
21282128
}
21292129

2130-
if comment.Type == models.CommentTypeComment {
2131-
if err := comment.LoadAttachments(); err != nil {
2132-
ctx.ServerError("LoadAttachments", err)
2133-
return
2134-
}
2135-
}
2136-
21372130
if !ctx.IsSigned || (ctx.User.ID != comment.PosterID && !ctx.Repo.CanWriteIssuesOrPulls(comment.Issue.IsPull)) {
21382131
ctx.Error(http.StatusForbidden)
21392132
return
@@ -2155,6 +2148,17 @@ func UpdateCommentContent(ctx *context.Context) {
21552148
return
21562149
}
21572150

2151+
if ctx.FormString("action") == "tasklist" {
2152+
return
2153+
}
2154+
2155+
if comment.Type == models.CommentTypeComment {
2156+
if err := comment.LoadAttachments(); err != nil {
2157+
ctx.ServerError("LoadAttachments", err)
2158+
return
2159+
}
2160+
}
2161+
21582162
if err := updateAttachments(comment, ctx.FormStrings("files[]")); err != nil {
21592163
ctx.ServerError("UpdateAttachments", err)
21602164
return

web_src/js/markup/tasklist.js

+3-10
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,13 @@ export function initMarkupTasklist() {
4343

4444
try {
4545
const editContentZone = container.querySelector('.edit-content-zone');
46-
const {updateUrl, context, attachmentUrl} = editContentZone.dataset;
47-
48-
const resp = await fetch(attachmentUrl);
49-
const attachments = await resp.json();
50-
const files = [];
51-
for (const attachment of attachments) {
52-
files.push(attachment.uuid);
53-
}
46+
const {updateUrl, context} = editContentZone.dataset;
5447

5548
await $.post(updateUrl, {
49+
action: 'tasklist',
5650
_csrf: window.config.csrf,
5751
content: newContent,
58-
context,
59-
files
52+
context
6053
});
6154

6255
rawContent.textContent = newContent;

0 commit comments

Comments
 (0)