diff options
author | sebastian-sauer <sauer.sebastian@gmail.com> | 2023-06-21 18:08:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-21 16:08:12 +0000 |
commit | 25455bc670910111d8cbb5293f95713416d22a0e (patch) | |
tree | 651e73a1742a45743715da6b82401c87af6314ea /templates/repo/diff | |
parent | ce46834b938eb687152a680669ada95a26304178 (diff) | |
download | gitea-25455bc670910111d8cbb5293f95713416d22a0e.tar.gz gitea-25455bc670910111d8cbb5293f95713416d22a0e.zip |
Show outdated comments in files changed tab (#24936)
If enabled show a clickable label in the comment. A click on the label
opens the Conversation tab with the comment focussed - there you're able
to view the old diff (or original diff the comment was created on).
**Screenshots**
![image](https://github.com/go-gitea/gitea/assets/1135157/63ab9571-a9ee-4900-9f02-94ab0095f9e7)
![image](https://github.com/go-gitea/gitea/assets/1135157/78f7c225-8d76-46f5-acfd-9b8aab988a6c)
When resolved and outdated:
![image](https://github.com/go-gitea/gitea/assets/1135157/6ece9ebd-c792-4aa5-9c35-628694e9d093)
Option to enable/disable this (stored in user settings - default is
disabled):
![image](https://github.com/go-gitea/gitea/assets/1135157/ed99dfe4-76dc-4c12-bd96-e7e62da50ab5)
![image](https://github.com/go-gitea/gitea/assets/1135157/e837a052-e92e-4a28-906d-9db5bacf93a6)
fixes #24913
---------
Co-authored-by: silverwind <me@silverwind.io>
Diffstat (limited to 'templates/repo/diff')
-rw-r--r-- | templates/repo/diff/comments.tmpl | 6 | ||||
-rw-r--r-- | templates/repo/diff/conversation.tmpl | 15 | ||||
-rw-r--r-- | templates/repo/diff/options_dropdown.tmpl | 15 | ||||
-rw-r--r-- | templates/repo/diff/whitespace_dropdown.tmpl | 10 |
4 files changed, 39 insertions, 7 deletions
diff --git a/templates/repo/diff/comments.tmpl b/templates/repo/diff/comments.tmpl index 5b0b32cc97..d19ac1f047 100644 --- a/templates/repo/diff/comments.tmpl +++ b/templates/repo/diff/comments.tmpl @@ -31,6 +31,12 @@ {{end}} </div> <div class="comment-header-right actions gt-df gt-ac"> + {{if .Invalidated}} + {{$referenceUrl := printf "%s#%s" $.root.Issue.Link .HashTag}} + <a href="{{AppSubUrl}}{{$referenceUrl}}" class="ui label basic small" data-tooltip-content="{{$.root.locale.Tr "repo.issues.review.outdated_description"}}"> + {{$.root.locale.Tr "repo.issues.review.outdated"}} + </a> + {{end}} {{if and .Review}} {{if eq .Review.Type 0}} <div class="ui label basic small yellow pending-label" data-tooltip-content="{{$.root.locale.Tr "repo.issues.review.pending.tooltip" ($.root.locale.Tr "repo.diff.review") ($.root.locale.Tr "repo.diff.review.approve") ($.root.locale.Tr "repo.diff.review.comment") ($.root.locale.Tr "repo.diff.review.reject")}}"> diff --git a/templates/repo/diff/conversation.tmpl b/templates/repo/diff/conversation.tmpl index 8d4064967e..ce344794ea 100644 --- a/templates/repo/diff/conversation.tmpl +++ b/templates/repo/diff/conversation.tmpl @@ -1,14 +1,25 @@ {{$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}} <div class="ui attached header resolved-placeholder gt-df gt-ac gt-sb"> - <div class="ui grey text"> + <div class="ui grey text gt-df gt-ac gt-fw gt-gap-2"> {{svg "octicon-check" 16 "icon gt-mr-2"}} <b>{{$resolveDoer.Name}}</b> {{$.locale.Tr "repo.issues.review.resolved_by"}} + {{if $invalid}} + <!-- + We only handle the case $resolved=true and $invalid=true in this template because if the comment is not resolved it has the outdated label in the comments area (not the header above). + The case $resolved=false and $invalid=true is handled in repo/diff/comments.tmpl + --> + <a href="{{AppSubUrl}}{{$referenceUrl}}" class="ui label basic small gt-ml-3" data-tooltip-content="{{$.locale.Tr "repo.issues.review.outdated_description"}}"> + {{$.locale.Tr "repo.issues.review.outdated"}} + </a> + {{end}} </div> - <div> + <div class="gt-df gt-ac gt-gap-3"> <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"> {{svg "octicon-unfold" 16 "gt-mr-3"}} {{$.locale.Tr "repo.issues.review.show_resolved"}} diff --git a/templates/repo/diff/options_dropdown.tmpl b/templates/repo/diff/options_dropdown.tmpl index faf378b388..172e674770 100644 --- a/templates/repo/diff/options_dropdown.tmpl +++ b/templates/repo/diff/options_dropdown.tmpl @@ -14,5 +14,20 @@ {{end}} <a id="expand-files-btn" class="item">{{.locale.Tr "repo.pulls.expand_files"}}</a> <a id="collapse-files-btn"class="item">{{.locale.Tr "repo.pulls.collapse_files"}}</a> + {{if .Issue.Index}} + {{if .ShowOutdatedComments}} + <a class="item" href="?style={{if $.IsSplitStyle}}split{{else}}unified{{end}}&whitespace={{$.WhitespaceBehavior}}&show-outdated=false"> + <label class="gt-pointer-events-none"> + {{.locale.Tr "repo.issues.review.option.hide_outdated_comments"}} + </label> + </a> + {{else}} + <a class="item" href="?style={{if $.IsSplitStyle}}split{{else}}unified{{end}}&whitespace={{$.WhitespaceBehavior}}&show-outdated=true"> + <label class="gt-pointer-events-none"> + {{.locale.Tr "repo.issues.review.option.show_outdated_comments"}} + </label> + </a> + {{end}} + {{end}} </div> </div> diff --git a/templates/repo/diff/whitespace_dropdown.tmpl b/templates/repo/diff/whitespace_dropdown.tmpl index 5a5b8c3dbd..a1830cb288 100644 --- a/templates/repo/diff/whitespace_dropdown.tmpl +++ b/templates/repo/diff/whitespace_dropdown.tmpl @@ -1,25 +1,25 @@ <div class="ui dropdown tiny basic button" data-tooltip-content="{{.locale.Tr "repo.diff.whitespace_button"}}"> {{svg "gitea-whitespace"}} <div class="menu"> - <a class="item" href="?style={{if .IsSplitStyle}}split{{else}}unified{{end}}&whitespace=show-all"> + <a class="item" href="?style={{if .IsSplitStyle}}split{{else}}unified{{end}}&whitespace=show-all&show-outdated={{$.ShowOutdatedComments}}"> <label class="gt-pointer-events-none"> <input class="gt-mr-3 gt-pointer-events-none" type="radio"{{if eq .WhitespaceBehavior "show-all"}} checked{{end}}> {{.locale.Tr "repo.diff.whitespace_show_everything"}} </label> </a> - <a class="item" href="?style={{if .IsSplitStyle}}split{{else}}unified{{end}}&whitespace=ignore-all"> + <a class="item" href="?style={{if .IsSplitStyle}}split{{else}}unified{{end}}&whitespace=ignore-all&show-outdated={{$.ShowOutdatedComments}}"> <label class="gt-pointer-events-none"> <input class="gt-mr-3 gt-pointer-events-none" type="radio"{{if eq .WhitespaceBehavior "ignore-all"}} checked{{end}}> {{.locale.Tr "repo.diff.whitespace_ignore_all_whitespace"}} </label> </a> - <a class="item" href="?style={{if .IsSplitStyle}}split{{else}}unified{{end}}&whitespace=ignore-change"> + <a class="item" href="?style={{if .IsSplitStyle}}split{{else}}unified{{end}}&whitespace=ignore-change&show-outdated={{$.ShowOutdatedComments}}"> <label class="gt-pointer-events-none"> <input class="gt-mr-3 gt-pointer-events-none" type="radio"{{if eq .WhitespaceBehavior "ignore-change"}} checked{{end}}> {{.locale.Tr "repo.diff.whitespace_ignore_amount_changes"}} </label> </a> - <a class="item" href="?style={{if .IsSplitStyle}}split{{else}}unified{{end}}&whitespace=ignore-eol"> + <a class="item" href="?style={{if .IsSplitStyle}}split{{else}}unified{{end}}&whitespace=ignore-eol&show-outdated={{$.ShowOutdatedComments}}"> <label class="gt-pointer-events-none"> <input class="gt-mr-3 gt-pointer-events-none" type="radio"{{if eq .WhitespaceBehavior "ignore-eol"}} checked{{end}}> {{.locale.Tr "repo.diff.whitespace_ignore_at_eol"}} @@ -27,4 +27,4 @@ </a> </div> </div> -<a class="ui tiny basic button" href="?style={{if .IsSplitStyle}}unified{{else}}split{{end}}&whitespace={{$.WhitespaceBehavior}}" data-tooltip-content="{{if .IsSplitStyle}}{{.locale.Tr "repo.diff.show_unified_view"}}{{else}}{{.locale.Tr "repo.diff.show_split_view"}}{{end}}">{{if .IsSplitStyle}}{{svg "gitea-join"}}{{else}}{{svg "gitea-split"}}{{end}}</a> +<a class="ui tiny basic button" href="?style={{if .IsSplitStyle}}unified{{else}}split{{end}}&whitespace={{$.WhitespaceBehavior}}&show-outdated={{$.ShowOutdatedComments}}" data-tooltip-content="{{if .IsSplitStyle}}{{.locale.Tr "repo.diff.show_unified_view"}}{{else}}{{.locale.Tr "repo.diff.show_split_view"}}{{end}}">{{if .IsSplitStyle}}{{svg "gitea-join"}}{{else}}{{svg "gitea-split"}}{{end}}</a> |