diff options
author | 赵智超 <1012112796@qq.com> | 2020-04-18 21:50:25 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-18 10:50:25 -0300 |
commit | 1b86f174ce99b579df35c32e800551b1fd1df807 (patch) | |
tree | e057206a13cea7a0e2eb0219bb66d8d83a8781c9 /templates/repo/issue/view_content/comments.tmpl | |
parent | 38d5f88a8183147cc5ecc6ece58fc28836a4af8b (diff) | |
download | gitea-1b86f174ce99b579df35c32e800551b1fd1df807.tar.gz gitea-1b86f174ce99b579df35c32e800551b1fd1df807.zip |
Add a way to mark Conversation (code comment) resolved (#11037)
* Add a way to mark Conversation (code comment) resolved
mark Conversation is a way to mark a Conversation is stale
or be solved. when it's marked as stale, will be hided like
stale. all Pull Request writer , Offical Reviewers and poster
can add or remove Conversation resolved mark.
Signed-off-by: a1012112796 <1012112796@qq.com>
* fix lint
* Apply suggestions from code review
* Add ResolveDoer
* fix ui
Co-Authored-By: Lauris BH <lauris@nix.lv>
Co-Authored-By: 6543 <6543@obermui.de>
* change IsResolved to an function
Add permission check in UpdateResolveConversation
* Apply suggestions from code review
* change return error for permisson check
* add default message for deleted user
* get issue message from comment
* add migration for ``ResolveDoerID`` column
another change:
* block mark pending review as resolved because it's not necessary
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
* change button color
* resolve button size
* fix code style
* remove unusefull code
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
Diffstat (limited to 'templates/repo/issue/view_content/comments.tmpl')
-rw-r--r-- | templates/repo/issue/view_content/comments.tmpl | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index da1483ec37..27baaed3f2 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -381,6 +381,7 @@ </div> </div> {{end}} + {{if .Review.CodeComments}} <div class="timeline-item event"> {{ range $filename, $lines := .Review.CodeComments}} @@ -388,14 +389,25 @@ <div class="ui segments"> <div class="ui segment"> {{$invalid := (index $comms 0).Invalidated}} - {{if $invalid}} + {{$resolved := (index $comms 0).IsResolved}} + {{$resolveDoer := (index $comms 0).ResolveDoer}} + {{$isNotPending := (not (eq (index $comms 0).Review.Type 0))}} + {{if or $invalid $resolved}} <button id="show-outdated-{{(index $comms 0).ID}}" data-comment="{{(index $comms 0).ID}}" class="ui compact right labeled button show-outdated"> - {{svg "octicon-fold" 16}} - {{$.i18n.Tr "repo.issues.review.show_outdated"}} + {{svg "octicon-unfold" 16}} + {{if $invalid }} + {{$.i18n.Tr "repo.issues.review.show_outdated"}} + {{else}} + {{$.i18n.Tr "repo.issues.review.show_resolved"}} + {{end}} </button> <button id="hide-outdated-{{(index $comms 0).ID}}" data-comment="{{(index $comms 0).ID}}" class="hide ui compact right labeled button hide-outdated"> {{svg "octicon-fold" 16}} - {{$.i18n.Tr "repo.issues.review.hide_outdated"}} + {{if $invalid}} + {{$.i18n.Tr "repo.issues.review.hide_outdated"}} + {{else}} + {{$.i18n.Tr "repo.issues.review.hide_resolved"}} + {{end}} </button> {{end}} <a href="{{(index $comms 0).CodeCommentURL}}" class="file-comment">{{$filename}}</a> @@ -403,7 +415,7 @@ {{$diff := (CommentMustAsDiff (index $comms 0))}} {{if $diff}} {{$file := (index $diff.Files 0)}} - <div id="code-preview-{{(index $comms 0).ID}}" class="ui table segment{{if $invalid}} hide{{end}}"> + <div id="code-preview-{{(index $comms 0).ID}}" class="ui table segment{{if or $invalid $resolved}} hide{{end}}"> <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"> <table> @@ -415,7 +427,7 @@ </div> </div> {{end}} - <div id="code-comments-{{(index $comms 0).ID}}" class="ui segment{{if $invalid}} hide{{end}}"> + <div id="code-comments-{{(index $comms 0).ID}}" class="ui segment{{if or $invalid $resolved}} hide{{end}}"> <div class="ui comments"> {{range $comms}} {{ $createdSubStr:= TimeSinceUnix .CreatedUnix $.Lang }} @@ -445,6 +457,20 @@ {{end}} </div> {{template "repo/diff/comment_form_datahandler" dict "hidden" true "reply" (index $comms 0).ReviewID "root" $ "comment" (index $comms 0)}} + + {{if and $.CanMarkConversation $isNotPending}} + <button class="ui tiny button resolve-conversation" data-action="{{if not $resolved}}Resolve{{else}}UnResolve{{end}}" data-comment-id="{{(index $comms 0).ID}}" data-update-url="{{$.RepoLink}}/issues/resolve_conversation" > + {{if $resolved}} + {{$.i18n.Tr "repo.issues.review.un_resolve_conversation"}} + {{else}} + {{$.i18n.Tr "repo.issues.review.resolve_conversation"}} + {{end}} + </button> + {{end}} + + {{if $resolved}} + <span class="ui grey text"><b>{{$resolveDoer.Name}}</b> {{$.i18n.Tr "repo.issues.review.resolved_by"}}</span> + {{end}} </div> </div> {{end}} |