Skip to content

Commit 692f0aa

Browse files
committed
Reimplement edit comment for conversations
1 parent 17fb682 commit 692f0aa

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

routers/web/repo/conversation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,7 @@ func UpdateConversationCommentContent(ctx *context.Context) {
10131013

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

templates/repo/conversation/comments.tmpl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,15 @@
7575
{{end}}
7676
</div>
7777
<div id="{{if $IsIssue}}issue{{end}}comment-{{.ID}}-raw" class="raw-content tw-hidden">{{.Content}}</div>
78-
<div class="edit-content-zone tw-hidden" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-content-version="{{.ContentVersion}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div>
78+
79+
{{if $IsIssue}}
80+
{{$EditURL:=printf "%s/%s/%d" $.RepoLink "comments" .ID}}
81+
<div class="edit-content-zone tw-hidden" data-update-url="{{$EditURL}}" data-content-version="{{.ContentVersion}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$EditURL}}/attachments"></div>
82+
{{else}}
83+
{{$EditURL:=printf "%s/%s/%d" $.RepoLink "conversations/comments" .ID}}
84+
<div class="edit-content-zone tw-hidden" data-update-url="{{$EditURL}}" data-content-version="{{.ContentVersion}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$EditURL}}/attachments"></div>
85+
{{end}}
86+
7987
{{if .Attachments}}
8088
{{template "repo/issue/view_content/attachments" dict "Attachments" .Attachments "RenderedContent" .RenderedContent}}
8189
{{end}}

web_src/js/features/repo-conversation-edit.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export function initRepoConversationCommentEdit() {
7272

7373
const response = await POST(editContentZone.getAttribute('data-update-url'), {data: params});
7474
const data = await response.json();
75+
7576
if (response.status === 400) {
7677
showErrorToast(data.errorMessage);
7778
return;

0 commit comments

Comments
 (0)