[GITEA] always load outdated comments

(cherry picked from commit 2615dea9af10b9400bdf96cf8c3cf7c6e349d5ed)
This commit is contained in:
oliverpool 2024-02-02 10:40:27 +01:00 committed by Earl Warren
parent 49b51cbdd7
commit ecfc3cb3f0
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 0579CB2928A78A00
2 changed files with 6 additions and 5 deletions

View file

@ -153,7 +153,7 @@ func UpdateResolveConversation(ctx *context.Context) {
} }
func renderConversation(ctx *context.Context, comment *issues_model.Comment, origin string) { func renderConversation(ctx *context.Context, comment *issues_model.Comment, origin string) {
comments, err := issues_model.FetchCodeCommentsByLine(ctx, comment.Issue, ctx.Doer, comment.TreePath, comment.Line, ctx.Data["ShowOutdatedComments"].(bool)) comments, err := issues_model.FetchCodeCommentsByLine(ctx, comment.Issue, ctx.Doer, comment.TreePath, comment.Line, true)
if err != nil { if err != nil {
ctx.ServerError("FetchCodeCommentsByLine", err) ctx.ServerError("FetchCodeCommentsByLine", err)
return return

View file

@ -1,6 +1,7 @@
{{$invalid := (index .comments 0).Invalidated}} {{$invalid := (index .comments 0).Invalidated}}
{{$resolved := (index .comments 0).IsResolved}} {{$resolved := (index .comments 0).IsResolved}}
{{$resolveDoer := (index .comments 0).ResolveDoer}} {{$resolveDoer := (index .comments 0).ResolveDoer}}
{{$hideByDefault := or $resolved (and $invalid (not .ShowOutdatedComments))}}
{{$isNotPending := (not (eq (index .comments 0).Review.Type 0))}} {{$isNotPending := (not (eq (index .comments 0).Review.Type 0))}}
<div class="ui segments conversation-holder"> <div class="ui segments conversation-holder">
<div class="ui segment collapsible-comment-box gt-py-3 gt-df gt-ac gt-sb"> <div class="ui segment collapsible-comment-box gt-py-3 gt-df gt-ac gt-sb">
@ -14,7 +15,7 @@
</div> </div>
<div> <div>
{{if or $invalid $resolved}} {{if or $invalid $resolved}}
<button id="show-outdated-{{(index .comments 0).ID}}" data-comment="{{(index .comments 0).ID}}" class="{{if not $resolved}}gt-hidden {{end}}ui compact labeled button show-outdated gt-df gt-ac"> <button id="show-outdated-{{(index .comments 0).ID}}" data-comment="{{(index .comments 0).ID}}" class="{{if not $hideByDefault}}gt-hidden {{end}}ui compact labeled button show-outdated gt-df gt-ac">
{{svg "octicon-unfold" 16 "gt-mr-3"}} {{svg "octicon-unfold" 16 "gt-mr-3"}}
{{if $resolved}} {{if $resolved}}
{{ctx.Locale.Tr "repo.issues.review.show_resolved"}} {{ctx.Locale.Tr "repo.issues.review.show_resolved"}}
@ -22,7 +23,7 @@
{{ctx.Locale.Tr "repo.issues.review.show_outdated"}} {{ctx.Locale.Tr "repo.issues.review.show_outdated"}}
{{end}} {{end}}
</button> </button>
<button id="hide-outdated-{{(index .comments 0).ID}}" data-comment="{{(index .comments 0).ID}}" class="{{if $resolved}}gt-hidden {{end}}ui compact labeled button hide-outdated gt-df gt-ac"> <button id="hide-outdated-{{(index .comments 0).ID}}" data-comment="{{(index .comments 0).ID}}" class="{{if $hideByDefault}}gt-hidden {{end}}ui compact labeled button hide-outdated gt-df gt-ac">
{{svg "octicon-fold" 16 "gt-mr-3"}} {{svg "octicon-fold" 16 "gt-mr-3"}}
{{if $resolved}} {{if $resolved}}
{{ctx.Locale.Tr "repo.issues.review.hide_resolved"}} {{ctx.Locale.Tr "repo.issues.review.hide_resolved"}}
@ -36,7 +37,7 @@
{{$diff := (CommentMustAsDiff ctx (index .comments 0))}} {{$diff := (CommentMustAsDiff ctx (index .comments 0))}}
{{if $diff}} {{if $diff}}
{{$file := (index $diff.Files 0)}} {{$file := (index $diff.Files 0)}}
<div id="code-preview-{{(index .comments 0).ID}}" class="ui table segment{{if $resolved}} gt-hidden{{end}}"> <div id="code-preview-{{(index .comments 0).ID}}" class="ui table segment{{if $hideByDefault}} gt-hidden{{end}}">
<div class="diff-file-box diff-box file-content {{TabSizeClass $.Editorconfig $file.Name}}"> <div class="diff-file-box diff-box file-content {{TabSizeClass $.Editorconfig $file.Name}}">
<div class="file-body file-code code-view code-diff code-diff-unified unicode-escaped"> <div class="file-body file-code code-view code-diff code-diff-unified unicode-escaped">
<table> <table>
@ -48,7 +49,7 @@
</div> </div>
</div> </div>
{{end}} {{end}}
<div id="code-comments-{{(index .comments 0).ID}}" class="comment-code-cloud ui segment{{if $resolved}} gt-hidden{{end}}"> <div id="code-comments-{{(index .comments 0).ID}}" class="comment-code-cloud ui segment{{if $hideByDefault}} gt-hidden{{end}}">
<div class="ui comments gt-mb-0"> <div class="ui comments gt-mb-0">
{{range .comments}} {{range .comments}}
{{$createdSubStr:= TimeSinceUnix .CreatedUnix ctx.Locale}} {{$createdSubStr:= TimeSinceUnix .CreatedUnix ctx.Locale}}