Skip to content

Commit ecfc3cb

Browse files
oliverpoolearl-warren
authored andcommitted
[GITEA] always load outdated comments
(cherry picked from commit 2615dea9af10b9400bdf96cf8c3cf7c6e349d5ed)
1 parent 49b51cb commit ecfc3cb

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

routers/web/repo/pull_review.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ func UpdateResolveConversation(ctx *context.Context) {
153153
}
154154

155155
func renderConversation(ctx *context.Context, comment *issues_model.Comment, origin string) {
156-
comments, err := issues_model.FetchCodeCommentsByLine(ctx, comment.Issue, ctx.Doer, comment.TreePath, comment.Line, ctx.Data["ShowOutdatedComments"].(bool))
156+
comments, err := issues_model.FetchCodeCommentsByLine(ctx, comment.Issue, ctx.Doer, comment.TreePath, comment.Line, true)
157157
if err != nil {
158158
ctx.ServerError("FetchCodeCommentsByLine", err)
159159
return

templates/repo/issue/view_content/conversation.tmpl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{{$invalid := (index .comments 0).Invalidated}}
22
{{$resolved := (index .comments 0).IsResolved}}
33
{{$resolveDoer := (index .comments 0).ResolveDoer}}
4+
{{$hideByDefault := or $resolved (and $invalid (not .ShowOutdatedComments))}}
45
{{$isNotPending := (not (eq (index .comments 0).Review.Type 0))}}
56
<div class="ui segments conversation-holder">
67
<div class="ui segment collapsible-comment-box gt-py-3 gt-df gt-ac gt-sb">
@@ -14,15 +15,15 @@
1415
</div>
1516
<div>
1617
{{if or $invalid $resolved}}
17-
<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">
18+
<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">
1819
{{svg "octicon-unfold" 16 "gt-mr-3"}}
1920
{{if $resolved}}
2021
{{ctx.Locale.Tr "repo.issues.review.show_resolved"}}
2122
{{else}}
2223
{{ctx.Locale.Tr "repo.issues.review.show_outdated"}}
2324
{{end}}
2425
</button>
25-
<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">
26+
<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">
2627
{{svg "octicon-fold" 16 "gt-mr-3"}}
2728
{{if $resolved}}
2829
{{ctx.Locale.Tr "repo.issues.review.hide_resolved"}}
@@ -36,7 +37,7 @@
3637
{{$diff := (CommentMustAsDiff ctx (index .comments 0))}}
3738
{{if $diff}}
3839
{{$file := (index $diff.Files 0)}}
39-
<div id="code-preview-{{(index .comments 0).ID}}" class="ui table segment{{if $resolved}} gt-hidden{{end}}">
40+
<div id="code-preview-{{(index .comments 0).ID}}" class="ui table segment{{if $hideByDefault}} gt-hidden{{end}}">
4041
<div class="diff-file-box diff-box file-content {{TabSizeClass $.Editorconfig $file.Name}}">
4142
<div class="file-body file-code code-view code-diff code-diff-unified unicode-escaped">
4243
<table>
@@ -48,7 +49,7 @@
4849
</div>
4950
</div>
5051
{{end}}
51-
<div id="code-comments-{{(index .comments 0).ID}}" class="comment-code-cloud ui segment{{if $resolved}} gt-hidden{{end}}">
52+
<div id="code-comments-{{(index .comments 0).ID}}" class="comment-code-cloud ui segment{{if $hideByDefault}} gt-hidden{{end}}">
5253
<div class="ui comments gt-mb-0">
5354
{{range .comments}}
5455
{{$createdSubStr:= TimeSinceUnix .CreatedUnix ctx.Locale}}

0 commit comments

Comments
 (0)