Reply button is not removed when deleting a code review comment (#13824)
Backport #13774
This commit is contained in:
parent
0d43a2a069
commit
10fff12da4
3 changed files with 100 additions and 90 deletions
|
@ -166,74 +166,78 @@
|
||||||
<td class="lines-num"></td>
|
<td class="lines-num"></td>
|
||||||
<td class="lines-type-marker"></td>
|
<td class="lines-type-marker"></td>
|
||||||
<td class="add-comment-left">
|
<td class="add-comment-left">
|
||||||
{{if and $resolved (eq $line.GetCommentSide "previous")}}
|
<div class="conversation-holder">
|
||||||
<div class="ui top attached header">
|
{{if and $resolved (eq $line.GetCommentSide "previous")}}
|
||||||
<span class="ui grey text left"><b>{{$resolveDoer.Name}}</b> {{$.i18n.Tr "repo.issues.review.resolved_by"}}</span>
|
<div class="ui top attached header">
|
||||||
<button id="show-outdated-{{(index $line.Comments 0).ID}}" data-comment="{{(index $line.Comments 0).ID}}" class="ui compact right labeled button show-outdated">
|
<span class="ui grey text left"><b>{{$resolveDoer.Name}}</b> {{$.i18n.Tr "repo.issues.review.resolved_by"}}</span>
|
||||||
{{svg "octicon-unfold"}}
|
<button id="show-outdated-{{(index $line.Comments 0).ID}}" data-comment="{{(index $line.Comments 0).ID}}" class="ui compact right labeled button show-outdated">
|
||||||
{{$.i18n.Tr "repo.issues.review.show_resolved"}}
|
{{svg "octicon-unfold"}}
|
||||||
</button>
|
{{$.i18n.Tr "repo.issues.review.show_resolved"}}
|
||||||
<button id="hide-outdated-{{(index $line.Comments 0).ID}}" data-comment="{{(index $line.Comments 0).ID}}" class="hide ui compact right labeled button hide-outdated">
|
|
||||||
{{svg "octicon-fold"}}
|
|
||||||
{{$.i18n.Tr "repo.issues.review.hide_resolved"}}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
{{end}}
|
|
||||||
{{if eq $line.GetCommentSide "previous"}}
|
|
||||||
<div id="code-comments-{{(index $line.Comments 0).ID}}" class="field comment-code-cloud {{if $resolved}}hide{{end}}">
|
|
||||||
<div class="comment-list">
|
|
||||||
<ui class="ui comments">
|
|
||||||
{{ template "repo/diff/comments" dict "root" $ "comments" $line.Comments}}
|
|
||||||
</ui>
|
|
||||||
</div>
|
|
||||||
{{template "repo/diff/comment_form_datahandler" dict "reply" (index $line.Comments 0).ReviewID "hidden" true "root" $ "comment" (index $line.Comments 0)}}
|
|
||||||
{{if and $.CanMarkConversation $isNotPending}}
|
|
||||||
<button class="ui icon tiny button resolve-conversation" data-action="{{if not $resolved}}Resolve{{else}}UnResolve{{end}}" data-comment-id="{{(index $line.Comments 0).ID}}" data-update-url="{{$.RepoLink}}/issues/resolve_conversation" >
|
|
||||||
{{if $resolved}}
|
|
||||||
{{$.i18n.Tr "repo.issues.review.un_resolve_conversation"}}
|
|
||||||
{{else}}
|
|
||||||
{{$.i18n.Tr "repo.issues.review.resolve_conversation"}}
|
|
||||||
{{end}}
|
|
||||||
</button>
|
</button>
|
||||||
{{end}}
|
<button id="hide-outdated-{{(index $line.Comments 0).ID}}" data-comment="{{(index $line.Comments 0).ID}}" class="hide ui compact right labeled button hide-outdated">
|
||||||
</div>
|
{{svg "octicon-fold"}}
|
||||||
{{end}}
|
{{$.i18n.Tr "repo.issues.review.hide_resolved"}}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
|
{{if eq $line.GetCommentSide "previous"}}
|
||||||
|
<div id="code-comments-{{(index $line.Comments 0).ID}}" class="field comment-code-cloud {{if $resolved}}hide{{end}}">
|
||||||
|
<div class="comment-list">
|
||||||
|
<ui class="ui comments">
|
||||||
|
{{ template "repo/diff/comments" dict "root" $ "comments" $line.Comments}}
|
||||||
|
</ui>
|
||||||
|
</div>
|
||||||
|
{{template "repo/diff/comment_form_datahandler" dict "reply" (index $line.Comments 0).ReviewID "hidden" true "root" $ "comment" (index $line.Comments 0)}}
|
||||||
|
{{if and $.CanMarkConversation $isNotPending}}
|
||||||
|
<button class="ui icon tiny button resolve-conversation" data-action="{{if not $resolved}}Resolve{{else}}UnResolve{{end}}" data-comment-id="{{(index $line.Comments 0).ID}}" data-update-url="{{$.RepoLink}}/issues/resolve_conversation" >
|
||||||
|
{{if $resolved}}
|
||||||
|
{{$.i18n.Tr "repo.issues.review.un_resolve_conversation"}}
|
||||||
|
{{else}}
|
||||||
|
{{$.i18n.Tr "repo.issues.review.resolve_conversation"}}
|
||||||
|
{{end}}
|
||||||
|
</button>
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="lines-num"></td>
|
<td class="lines-num"></td>
|
||||||
<td class="lines-type-marker"></td>
|
<td class="lines-type-marker"></td>
|
||||||
<td class="add-comment-right">
|
<td class="add-comment-right">
|
||||||
{{if and $resolved (eq $line.GetCommentSide "proposed")}}
|
<div class="conversation-holder">
|
||||||
<div class="ui top attached header">
|
{{if and $resolved (eq $line.GetCommentSide "proposed")}}
|
||||||
<span class="ui grey text left"><b>{{$resolveDoer.Name}}</b> {{$.i18n.Tr "repo.issues.review.resolved_by"}}</span>
|
<div class="ui top attached header">
|
||||||
<button id="show-outdated-{{(index $line.Comments 0).ID}}" data-comment="{{(index $line.Comments 0).ID}}" class="ui compact right labeled button show-outdated">
|
<span class="ui grey text left"><b>{{$resolveDoer.Name}}</b> {{$.i18n.Tr "repo.issues.review.resolved_by"}}</span>
|
||||||
{{svg "octicon-unfold"}}
|
<button id="show-outdated-{{(index $line.Comments 0).ID}}" data-comment="{{(index $line.Comments 0).ID}}" class="ui compact right labeled button show-outdated">
|
||||||
{{$.i18n.Tr "repo.issues.review.show_resolved"}}
|
{{svg "octicon-unfold"}}
|
||||||
</button>
|
{{$.i18n.Tr "repo.issues.review.show_resolved"}}
|
||||||
<button id="hide-outdated-{{(index $line.Comments 0).ID}}" data-comment="{{(index $line.Comments 0).ID}}" class="hide ui compact right labeled button hide-outdated">
|
|
||||||
{{svg "octicon-fold"}}
|
|
||||||
{{$.i18n.Tr "repo.issues.review.hide_resolved"}}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
{{end}}
|
|
||||||
{{if eq $line.GetCommentSide "proposed"}}
|
|
||||||
<div id="code-comments-{{(index $line.Comments 0).ID}}" class="field comment-code-cloud {{if $resolved}}hide{{end}}">
|
|
||||||
<div class="comment-list">
|
|
||||||
<ui class="ui comments">
|
|
||||||
{{ template "repo/diff/comments" dict "root" $ "comments" $line.Comments}}
|
|
||||||
</ui>
|
|
||||||
</div>
|
|
||||||
{{template "repo/diff/comment_form_datahandler" dict "reply" (index $line.Comments 0).ReviewID "hidden" true "root" $ "comment" (index $line.Comments 0)}}
|
|
||||||
{{if and $.CanMarkConversation $isNotPending}}
|
|
||||||
<button class="ui icon tiny button resolve-conversation" data-action="{{if not $resolved}}Resolve{{else}}UnResolve{{end}}" data-comment-id="{{(index $line.Comments 0).ID}}" data-update-url="{{$.RepoLink}}/issues/resolve_conversation" >
|
|
||||||
{{if $resolved}}
|
|
||||||
{{$.i18n.Tr "repo.issues.review.un_resolve_conversation"}}
|
|
||||||
{{else}}
|
|
||||||
{{$.i18n.Tr "repo.issues.review.resolve_conversation"}}
|
|
||||||
{{end}}
|
|
||||||
</button>
|
</button>
|
||||||
{{end}}
|
<button id="hide-outdated-{{(index $line.Comments 0).ID}}" data-comment="{{(index $line.Comments 0).ID}}" class="hide ui compact right labeled button hide-outdated">
|
||||||
</div>
|
{{svg "octicon-fold"}}
|
||||||
{{end}}
|
{{$.i18n.Tr "repo.issues.review.hide_resolved"}}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
|
{{if eq $line.GetCommentSide "proposed"}}
|
||||||
|
<div id="code-comments-{{(index $line.Comments 0).ID}}" class="field comment-code-cloud {{if $resolved}}hide{{end}}">
|
||||||
|
<div class="comment-list">
|
||||||
|
<ui class="ui comments">
|
||||||
|
{{ template "repo/diff/comments" dict "root" $ "comments" $line.Comments}}
|
||||||
|
</ui>
|
||||||
|
</div>
|
||||||
|
{{template "repo/diff/comment_form_datahandler" dict "reply" (index $line.Comments 0).ReviewID "hidden" true "root" $ "comment" (index $line.Comments 0)}}
|
||||||
|
{{if and $.CanMarkConversation $isNotPending}}
|
||||||
|
<button class="ui icon tiny button resolve-conversation" data-action="{{if not $resolved}}Resolve{{else}}UnResolve{{end}}" data-comment-id="{{(index $line.Comments 0).ID}}" data-update-url="{{$.RepoLink}}/issues/resolve_conversation" >
|
||||||
|
{{if $resolved}}
|
||||||
|
{{$.i18n.Tr "repo.issues.review.un_resolve_conversation"}}
|
||||||
|
{{else}}
|
||||||
|
{{$.i18n.Tr "repo.issues.review.resolve_conversation"}}
|
||||||
|
{{end}}
|
||||||
|
</button>
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
|
@ -39,35 +39,37 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" class="lines-num"></td>
|
<td colspan="2" class="lines-num"></td>
|
||||||
<td class="add-comment-left add-comment-right" colspan="2">
|
<td class="add-comment-left add-comment-right" colspan="2">
|
||||||
{{if $resolved}}
|
<div class="conversation-holder">
|
||||||
<div class = "ui attached header">
|
{{if $resolved}}
|
||||||
<span class="ui grey text left"><b>{{$resolveDoer.Name}}</b> {{$.root.i18n.Tr "repo.issues.review.resolved_by"}}</span>
|
<div class = "ui attached header">
|
||||||
<button id="show-outdated-{{(index $line.Comments 0).ID}}" data-comment="{{(index $line.Comments 0).ID}}" class="ui compact right labeled button show-outdated">
|
<span class="ui grey text left"><b>{{$resolveDoer.Name}}</b> {{$.root.i18n.Tr "repo.issues.review.resolved_by"}}</span>
|
||||||
{{svg "octicon-unfold"}}
|
<button id="show-outdated-{{(index $line.Comments 0).ID}}" data-comment="{{(index $line.Comments 0).ID}}" class="ui compact right labeled button show-outdated">
|
||||||
{{$.root.i18n.Tr "repo.issues.review.show_resolved"}}
|
{{svg "octicon-unfold"}}
|
||||||
</button>
|
{{$.root.i18n.Tr "repo.issues.review.show_resolved"}}
|
||||||
<button id="hide-outdated-{{(index $line.Comments 0).ID}}" data-comment="{{(index $line.Comments 0).ID}}" class="hide ui compact right labeled button hide-outdated">
|
</button>
|
||||||
{{svg "octicon-fold"}}
|
<button id="hide-outdated-{{(index $line.Comments 0).ID}}" data-comment="{{(index $line.Comments 0).ID}}" class="hide ui compact right labeled button hide-outdated">
|
||||||
{{$.root.i18n.Tr "repo.issues.review.hide_resolved"}}
|
{{svg "octicon-fold"}}
|
||||||
</button>
|
{{$.root.i18n.Tr "repo.issues.review.hide_resolved"}}
|
||||||
</div>
|
</button>
|
||||||
{{end}}
|
</div>
|
||||||
<div id="code-comments-{{(index $line.Comments 0).ID}}" class="field comment-code-cloud {{if $resolved}}hide{{end}}">
|
|
||||||
<div class="comment-list">
|
|
||||||
<ui class="ui comments">
|
|
||||||
{{ template "repo/diff/comments" dict "root" $.root "comments" $line.Comments}}
|
|
||||||
</ui>
|
|
||||||
</div>
|
|
||||||
{{template "repo/diff/comment_form_datahandler" dict "hidden" true "reply" (index $line.Comments 0).ReviewID "root" $.root "comment" (index $line.Comments 0)}}
|
|
||||||
{{if and $.root.CanMarkConversation $isNotPending}}
|
|
||||||
<button class="ui icon tiny button resolve-conversation" data-action="{{if not $resolved}}Resolve{{else}}UnResolve{{end}}" data-comment-id="{{(index $line.Comments 0).ID}}" data-update-url="{{$.root.RepoLink}}/issues/resolve_conversation" >
|
|
||||||
{{if $resolved}}
|
|
||||||
{{$.root.i18n.Tr "repo.issues.review.un_resolve_conversation"}}
|
|
||||||
{{else}}
|
|
||||||
{{$.root.i18n.Tr "repo.issues.review.resolve_conversation"}}
|
|
||||||
{{end}}
|
|
||||||
</button>
|
|
||||||
{{end}}
|
{{end}}
|
||||||
|
<div id="code-comments-{{(index $line.Comments 0).ID}}" class="field comment-code-cloud {{if $resolved}}hide{{end}}">
|
||||||
|
<div class="comment-list">
|
||||||
|
<ui class="ui comments">
|
||||||
|
{{ template "repo/diff/comments" dict "root" $.root "comments" $line.Comments}}
|
||||||
|
</ui>
|
||||||
|
</div>
|
||||||
|
{{template "repo/diff/comment_form_datahandler" dict "hidden" true "reply" (index $line.Comments 0).ReviewID "root" $.root "comment" (index $line.Comments 0)}}
|
||||||
|
{{if and $.root.CanMarkConversation $isNotPending}}
|
||||||
|
<button class="ui icon tiny button resolve-conversation" data-action="{{if not $resolved}}Resolve{{else}}UnResolve{{end}}" data-comment-id="{{(index $line.Comments 0).ID}}" data-update-url="{{$.root.RepoLink}}/issues/resolve_conversation" >
|
||||||
|
{{if $resolved}}
|
||||||
|
{{$.root.i18n.Tr "repo.issues.review.un_resolve_conversation"}}
|
||||||
|
{{else}}
|
||||||
|
{{$.root.i18n.Tr "repo.issues.review.resolve_conversation"}}
|
||||||
|
{{end}}
|
||||||
|
</button>
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -1055,7 +1055,11 @@ async function initRepository() {
|
||||||
$.post($this.data('url'), {
|
$.post($this.data('url'), {
|
||||||
_csrf: csrf
|
_csrf: csrf
|
||||||
}).done(() => {
|
}).done(() => {
|
||||||
|
const $conversationHolder = $this.closest('.conversation-holder');
|
||||||
$(`#${$this.data('comment-id')}`).remove();
|
$(`#${$this.data('comment-id')}`).remove();
|
||||||
|
if ($conversationHolder.length && !$conversationHolder.find('.comment').length) {
|
||||||
|
$conversationHolder.remove();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Reference in a new issue