Skip to content

Commit

Permalink
Show outdated comments in files changed view
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-sauer committed May 25, 2023
1 parent 2dac9ba commit f7be42e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 12 deletions.
5 changes: 0 additions & 5 deletions models/issues/comment_code.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import (
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/markup"
"code.gitea.io/gitea/modules/markup/markdown"

"xorm.io/builder"
)

// CodeComments represents comments on code by using this structure: FILENAME -> LINE (+ == proposed; - == previous) -> COMMENTS
Expand Down Expand Up @@ -53,9 +51,6 @@ func findCodeComments(ctx context.Context, opts FindCommentsOptions, issue *Issu
review = &Review{ID: 0}
}
conds := opts.ToConds()
if review.ID == 0 {
conds = conds.And(builder.Eq{"invalidated": false})
}
e := db.GetEngine(ctx)
if err := e.Where(conds).
Asc("comment.created_unix").
Expand Down
2 changes: 2 additions & 0 deletions options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1604,6 +1604,8 @@ issues.review.show_outdated = Show outdated
issues.review.hide_outdated = Hide outdated
issues.review.show_resolved = Show resolved
issues.review.hide_resolved = Hide resolved
issues.review.comment_points_to_modified_line = Points to a modified code fragment.
issues.review.show_original_comment = Show original
issues.review.resolve_conversation = Resolve conversation
issues.review.un_resolve_conversation = Unresolve conversation
issues.review.resolved_by = marked this conversation as resolved
Expand Down
34 changes: 27 additions & 7 deletions templates/repo/diff/conversation.tmpl
Original file line number Diff line number Diff line change
@@ -1,21 +1,41 @@
{{$resolved := (index .comments 0).IsResolved}}
{{$invalid := (index .comments 0).Invalidated}}
{{$resolveDoer := (index .comments 0).ResolveDoer}}
{{$isNotPending := (not (eq (index .comments 0).Review.Type 0))}}
{{$referenceUrl := printf "%s#%s" $.Issue.Link (index .comments 0).HashTag}}
<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}}">
{{if $resolved}}
{{if or $invalid $resolved}}
<div class="ui attached header resolved-placeholder gt-df gt-ac gt-sb">
<div class="ui grey text">
{{svg "octicon-check" 16 "icon gt-mr-2"}}
<b>{{$resolveDoer.Name}}</b> {{$.locale.Tr "repo.issues.review.resolved_by"}}
{{if $resolved}}
{{svg "octicon-check" 16 "icon gt-mr-2"}}
<b>{{$resolveDoer.Name}}</b> {{$.locale.Tr "repo.issues.review.resolved_by"}}
{{end}}
{{if $invalid}}
{{if $resolved}}
|
{{else}}
{{svg "octicon-alert-fill" 16 "icon gt-mr-2"}}
{{end}}
{{$.locale.Tr "repo.issues.review.comment_points_to_modified_line"}} <a href="{{AppSubUrl}}{{$referenceUrl}}">{{$.locale.Tr "repo.issues.review.show_original_comment"}}</a>
{{end}}
</div>
<div>
<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">
<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">
{{svg "octicon-unfold" 16 "gt-mr-3"}}
{{$.locale.Tr "repo.issues.review.show_resolved"}}
{{if $resolved}}
{{$.locale.Tr "repo.issues.review.show_resolved"}}
{{else}}
{{$.locale.Tr "repo.issues.review.show_outdated"}}
{{end}}
</button>
<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">
<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">
{{svg "octicon-fold" 16 "gt-mr-3"}}
{{$.locale.Tr "repo.issues.review.hide_resolved"}}
{{if $resolved}}
{{$.locale.Tr "repo.issues.review.hide_resolved"}}
{{else}}
{{$.locale.Tr "repo.issues.review.hide_outdated"}}
{{end}}
</button>
</div>
</div>
Expand Down

0 comments on commit f7be42e

Please sign in to comment.