Skip to content

Commit f7be42e

Browse files
Show outdated comments in files changed view
1 parent 2dac9ba commit f7be42e

File tree

3 files changed

+29
-12
lines changed

3 files changed

+29
-12
lines changed

models/issues/comment_code.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import (
1010
user_model "code.gitea.io/gitea/models/user"
1111
"code.gitea.io/gitea/modules/markup"
1212
"code.gitea.io/gitea/modules/markup/markdown"
13-
14-
"xorm.io/builder"
1513
)
1614

1715
// CodeComments represents comments on code by using this structure: FILENAME -> LINE (+ == proposed; - == previous) -> COMMENTS
@@ -53,9 +51,6 @@ func findCodeComments(ctx context.Context, opts FindCommentsOptions, issue *Issu
5351
review = &Review{ID: 0}
5452
}
5553
conds := opts.ToConds()
56-
if review.ID == 0 {
57-
conds = conds.And(builder.Eq{"invalidated": false})
58-
}
5954
e := db.GetEngine(ctx)
6055
if err := e.Where(conds).
6156
Asc("comment.created_unix").

options/locale/locale_en-US.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1604,6 +1604,8 @@ issues.review.show_outdated = Show outdated
16041604
issues.review.hide_outdated = Hide outdated
16051605
issues.review.show_resolved = Show resolved
16061606
issues.review.hide_resolved = Hide resolved
1607+
issues.review.comment_points_to_modified_line = Points to a modified code fragment.
1608+
issues.review.show_original_comment = Show original
16071609
issues.review.resolve_conversation = Resolve conversation
16081610
issues.review.un_resolve_conversation = Unresolve conversation
16091611
issues.review.resolved_by = marked this conversation as resolved

templates/repo/diff/conversation.tmpl

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,41 @@
11
{{$resolved := (index .comments 0).IsResolved}}
2+
{{$invalid := (index .comments 0).Invalidated}}
23
{{$resolveDoer := (index .comments 0).ResolveDoer}}
34
{{$isNotPending := (not (eq (index .comments 0).Review.Type 0))}}
5+
{{$referenceUrl := printf "%s#%s" $.Issue.Link (index .comments 0).HashTag}}
46
<div class="conversation-holder" data-path="{{(index .comments 0).TreePath}}" data-side="{{if lt (index .comments 0).Line 0}}left{{else}}right{{end}}" data-idx="{{(index .comments 0).UnsignedLine}}">
5-
{{if $resolved}}
7+
{{if or $invalid $resolved}}
68
<div class="ui attached header resolved-placeholder gt-df gt-ac gt-sb">
79
<div class="ui grey text">
8-
{{svg "octicon-check" 16 "icon gt-mr-2"}}
9-
<b>{{$resolveDoer.Name}}</b> {{$.locale.Tr "repo.issues.review.resolved_by"}}
10+
{{if $resolved}}
11+
{{svg "octicon-check" 16 "icon gt-mr-2"}}
12+
<b>{{$resolveDoer.Name}}</b> {{$.locale.Tr "repo.issues.review.resolved_by"}}
13+
{{end}}
14+
{{if $invalid}}
15+
{{if $resolved}}
16+
|
17+
{{else}}
18+
{{svg "octicon-alert-fill" 16 "icon gt-mr-2"}}
19+
{{end}}
20+
{{$.locale.Tr "repo.issues.review.comment_points_to_modified_line"}} <a href="{{AppSubUrl}}{{$referenceUrl}}">{{$.locale.Tr "repo.issues.review.show_original_comment"}}</a>
21+
{{end}}
1022
</div>
1123
<div>
12-
<button id="show-outdated-{{(index .comments 0).ID}}" data-comment="{{(index .comments 0).ID}}" class="ui tiny labeled button show-outdated gt-df gt-ac">
24+
<button id="show-outdated-{{(index .comments 0).ID}}" data-comment="{{(index .comments 0).ID}}" class="{{if not $resolved}}gt-hidden {{end}}ui tiny labeled button show-outdated gt-df gt-ac">
1325
{{svg "octicon-unfold" 16 "gt-mr-3"}}
14-
{{$.locale.Tr "repo.issues.review.show_resolved"}}
26+
{{if $resolved}}
27+
{{$.locale.Tr "repo.issues.review.show_resolved"}}
28+
{{else}}
29+
{{$.locale.Tr "repo.issues.review.show_outdated"}}
30+
{{end}}
1531
</button>
16-
<button id="hide-outdated-{{(index .comments 0).ID}}" data-comment="{{(index .comments 0).ID}}" class="ui tiny labeled button hide-outdated gt-df gt-ac gt-hidden">
32+
<button id="hide-outdated-{{(index .comments 0).ID}}" data-comment="{{(index .comments 0).ID}}" class="{{if $resolved}}gt-hidden {{end}}ui tiny labeled button hide-outdated gt-df gt-ac">
1733
{{svg "octicon-fold" 16 "gt-mr-3"}}
18-
{{$.locale.Tr "repo.issues.review.hide_resolved"}}
34+
{{if $resolved}}
35+
{{$.locale.Tr "repo.issues.review.hide_resolved"}}
36+
{{else}}
37+
{{$.locale.Tr "repo.issues.review.hide_outdated"}}
38+
{{end}}
1939
</button>
2040
</div>
2141
</div>

0 commit comments

Comments
 (0)