diff options
author | 赵智超 <1012112796@qq.com> | 2020-10-13 03:55:13 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-12 20:55:13 +0100 |
commit | 8be3e439c2b3a90fcb639b732008486b85314b8d (patch) | |
tree | 0d941779b1c545c4bfa41d8d54c1bf0f219a43eb /templates | |
parent | b546eda7a8fa17d86cf9722c9f7bcca009d40443 (diff) | |
download | gitea-8be3e439c2b3a90fcb639b732008486b85314b8d.tar.gz gitea-8be3e439c2b3a90fcb639b732008486b85314b8d.zip |
Add team support for review request (#12039)
Add team support for review request
Block #11355
Signed-off-by: a1012112796 <1012112796@qq.com>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'templates')
-rw-r--r-- | templates/repo/issue/view_content/comments.tmpl | 18 | ||||
-rw-r--r-- | templates/repo/issue/view_content/pull.tmpl | 54 | ||||
-rw-r--r-- | templates/repo/issue/view_content/sidebar.tmpl | 81 |
3 files changed, 72 insertions, 81 deletions
diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index 3b70a10715..f9ae9ba071 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -595,14 +595,22 @@ </a> <span class="text grey"> <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> - {{if .RemovedAssignee}} - {{if eq .PosterID .AssigneeID}} - {{$.i18n.Tr "repo.issues.review.remove_review_request_self" $createdStr | Safe}} + {{if (gt .AssigneeID 0)}} + {{if .RemovedAssignee}} + {{if eq .PosterID .AssigneeID}} + {{$.i18n.Tr "repo.issues.review.remove_review_request_self" $createdStr | Safe}} + {{else}} + {{$.i18n.Tr "repo.issues.review.remove_review_request" (.Assignee.GetDisplayName|Escape) $createdStr | Safe}} + {{end}} {{else}} - {{$.i18n.Tr "repo.issues.review.remove_review_request" (.Assignee.GetDisplayName|Escape) $createdStr | Safe}} + {{$.i18n.Tr "repo.issues.review.add_review_request" (.Assignee.GetDisplayName|Escape) $createdStr | Safe}} {{end}} {{else}} - {{$.i18n.Tr "repo.issues.review.add_review_request" (.Assignee.GetDisplayName|Escape) $createdStr | Safe}} + {{if .RemovedAssignee}} + {{$.i18n.Tr "repo.issues.review.remove_review_request" (.AssigneeTeam.Name|Escape) $createdStr | Safe}} + {{else}} + {{$.i18n.Tr "repo.issues.review.add_review_request" (.AssigneeTeam.Name|Escape) $createdStr | Safe}} + {{end}} {{end}} </span> </div> diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index 9111ab7e86..b21d53419f 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -1,24 +1,31 @@ -{{if gt (len .PullReviewers) 0}} +{{if .PullReviewers }} <div class="comment box"> <div class="content"> <div class="ui segment"> <h4>{{$.i18n.Tr "repo.issues.review.reviewers"}}</h4> {{range .PullReviewers}} - {{ $createdStr:= TimeSinceUnix .UpdatedUnix $.Lang }} + {{ $createdStr:= TimeSinceUnix .Review.UpdatedUnix $.Lang }} <div class="ui divider"></div> <div class="review-item"> <div class="review-item-left"> - <a class="ui avatar image" href="{{.Reviewer.HomeLink}}"> - <img src="{{.Reviewer.RelAvatarLink}}"> - </a> - <span class="text grey"><a href="{{.Reviewer.HomeLink}}">{{.Reviewer.Name}}</a> - {{if eq .Type 1}} + {{if .User}} + <a class="ui avatar image" href="{{.User.HomeLink}}"> + <img src="{{.User.RelAvatarLink}}"> + </a> + {{end}} + <span class="text grey"> + {{if .User}} + <a href="{{.User.HomeLink}}">{{.User.Name}}</a> + {{else if .Team}} + <span class="ui text">{{$.Issue.Repo.OwnerName}}/{{.Team.Name}}</span> + {{end}} + {{if eq .Review.Type 1}} {{$.i18n.Tr "repo.issues.review.approve" $createdStr | Safe}} - {{else if eq .Type 2}} + {{else if eq .Review.Type 2}} {{$.i18n.Tr "repo.issues.review.comment" $createdStr | Safe}} - {{else if eq .Type 3}} + {{else if eq .Review.Type 3}} {{$.i18n.Tr "repo.issues.review.reject" $createdStr | Safe}} - {{else if eq .Type 4}} + {{else if eq .Review.Type 4}} {{$.i18n.Tr "repo.issues.review.wait" $createdStr | Safe}} {{else}} {{$.i18n.Tr "repo.issues.review.comment" $createdStr | Safe}} @@ -26,34 +33,23 @@ </span> </div> <div class="review-item-right"> - {{if .Stale}} + {{if .Review.Stale}} <span class="ui poping up type-icon text grey" data-content="{{$.i18n.Tr "repo.issues.is_stale"}}"> <i class="octicon icon fa-hourglass-end"></i> </span> {{end}} - <span class="type-icon text {{if eq .Type 1}}green - {{- else if eq .Type 2}}grey - {{- else if eq .Type 3}}red - {{- else if eq .Type 4}}yellow + <span class="type-icon text {{if eq .Review.Type 1}}green + {{- else if eq .Review.Type 2}}grey + {{- else if eq .Review.Type 3}}red + {{- else if eq .Review.Type 4}}yellow {{else}}grey{{end}}"> - {{$canChoose := false}} - {{if eq .Type 4}} - {{if or (eq .ReviewerID $.SignedUserID) $.Permission.IsAdmin}} - {{$canChoose = true}} - {{end}} - {{else}} - {{if and (or $.IsIssuePoster $.CanChooseReviewer) (not (eq $.SignedUserID .ReviewerID))}} - {{$canChoose = true}} - {{end}} - {{end}} - - {{if $canChoose }} - <a href="#" class="ui poping up icon re-request-review" data-is-checked="{{if eq .Type 4}}true{{else}}false{{end}}" data-issue-id="{{$.Issue.ID}}" data-content="{{ if eq .Type 4 }} {{$.i18n.Tr "repo.issues.remove_request_review"}} {{else}} {{$.i18n.Tr "repo.issues.re_request_review"}} {{end}}" data-id="{{.ReviewerID}}" data-update-url="{{$.RepoLink}}/issues/request_review"> + {{if .CanChange }} + <a href="#" class="ui poping up icon re-request-review {{if .Checked}}checked{{end}}" data-issue-id="{{$.Issue.ID}}" data-content="{{if .Checked}} {{$.i18n.Tr "repo.issues.remove_request_review"}} {{else}} {{$.i18n.Tr "repo.issues.re_request_review"}} {{end}}" data-id="{{.ItemID}}" data-update-url="{{$.RepoLink}}/issues/request_review"> {{svg "octicon-sync"}} </a> {{end}} - {{svg (printf "octicon-%s" .Type.Icon)}} + {{svg (printf "octicon-%s" .Review.Type.Icon)}} </span> </div> </div> diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index e47bcbe35c..a1dbc7ef7f 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -5,7 +5,7 @@ {{if .Issue.IsPull }} <input id="reviewer_id" name="reviewer_id" type="hidden" value="{{.reviewer_id}}"> - <div class="ui {{if or (not .CanChooseReviewer) .Repository.IsArchived}}disabled{{end}} floating jump select-reviewers-modify dropdown"> + <div class="ui {{if or (not .Reviewers) (not .CanChooseReviewer) .Repository.IsArchived}}disabled{{end}} floating jump select-reviewers-modify dropdown"> <span class="text"> <strong>{{.i18n.Tr "repo.issues.review.reviewers"}}</strong> {{if and .CanChooseReviewer (not .Repository.IsArchived)}} @@ -20,36 +20,30 @@ <input type="text" placeholder="{{.i18n.Tr "repo.issues.filter_reviewers"}}"> </div> {{end}} - {{range .Reviewers}} - {{$ReviewerID := .ID}} - {{$checked := false}} - {{$canChoose := false}} - {{$notReviewed := true}} - - {{range $.PullReviewers}} - {{if eq .ReviewerID $ReviewerID }} - {{$notReviewed = false }} - {{if eq .Type 4 }} - {{$checked = true}} - {{if or (eq $ReviewerID $.SignedUserID) $.Permission.IsAdmin}} - {{$canChoose = true}} - {{end}} - {{else}} - {{$canChoose = true}} - {{end}} + {{if .Reviewers}} + {{range .Reviewers}} + {{if .User}} + <a class="{{if not .CanChange}}ui poping up{{end}} item {{if .Checked}} checked {{end}} {{if not .CanChange}}ban-change{{end}}" href="#" data-id="{{.ItemID}}" data-id-selector="#review_request_{{.ItemID}}" {{if not .CanChange}} data-content="{{$.i18n.Tr "repo.issues.remove_request_review_block"}}"{{end}}> + <span class="octicon-check {{if not .Checked}}invisible{{end}}">{{svg "octicon-check"}}</span> + <span class="text"> + <img class="ui avatar image" src="{{.User.RelAvatarLink}}"> {{.User.GetDisplayName}} + </span> + </a> {{end}} {{end}} - - {{ if $notReviewed}} - {{$canChoose = true}} + {{end}} + {{if .TeamReviewers}} + <div class="ui divider"></div> + {{range .TeamReviewers}} + {{if .Team}} + <a class="{{if not .CanChange}}ui poping up{{end}} item {{if .Checked}} checked {{end}} {{if not .CanChange}}ban-change{{end}}" href="#" data-id="{{.ItemID}}" data-id-selector="#review_request_team_{{.Team.ID}}" {{if not .CanChange}} data-content="{{$.i18n.Tr "repo.issues.remove_request_review_block"}}"{{end}}> + <span class="octicon-check {{if not .Checked}}invisible{{end}}">{{svg "octicon-check" 16}}</span> + <span class="text"> + {{svg "octicon-people" 16 "ml-4 mr-2"}}{{$.Issue.Repo.OwnerName}}/{{.Team.Name}} + </span> + </a> + {{end}} {{end}} - - <a class="{{if not $canChoose}}ui poping up{{end}} item {{if $checked}} checked {{end}} {{if not $canChoose}}ban-change{{end}}" href="#" data-id="{{.ID}}" data-id-selector="#review_request_{{.ID}}" {{if not $canChoose}} data-content="{{$.i18n.Tr "repo.issues.remove_request_review_block"}}"{{end}}> - <span class="octicon-check {{if not $checked}}invisible{{end}}">{{svg "octicon-check"}}</span> - <span class="text"> - <img class="ui avatar image" src="{{.RelAvatarLink}}"> {{.GetDisplayName}} - </span> - </a> {{end}} </div> </div> @@ -59,30 +53,23 @@ <div class="selected"> {{range .PullReviewers}} <div class="item" style="margin-bottom: 10px;"> - <a href="{{.Reviewer.HomeLink}}"><img class="ui avatar image" src="{{.Reviewer.RelAvatarLink}}"> {{.Reviewer.GetDisplayName}}</a> - <span class="ui right type-icon text {{if eq .Type 1}}green - {{- else if eq .Type 2}}grey - {{- else if eq .Type 3}}red - {{- else if eq .Type 4}}yellow + {{if .User}} + <a href="{{.User.HomeLink}}"><img class="ui avatar image" src="{{.User.RelAvatarLink}}"> {{.User.GetDisplayName}}</a> + {{else if .Team}} + <span class="text">{{svg "octicon-people" 16 "teamavatar"}}{{$.Issue.Repo.OwnerName}}/{{.Team.Name}}</span> + {{end}} + <span class="ui right type-icon text {{if eq .Review.Type 1}}green + {{- else if eq .Review.Type 2}}grey + {{- else if eq .Review.Type 3}}red + {{- else if eq .Review.Type 4}}yellow {{- else}}grey{{end}} right "> - {{$canChoose := false}} - {{if eq .Type 4}} - {{if or (eq .ReviewerID $.SignedUserID) $.Permission.IsAdmin}} - {{$canChoose = true}} - {{end}} - {{else}} - {{if and (or $.IsIssuePoster $.CanChooseReviewer) (not (eq $.SignedUserID .ReviewerID))}} - {{$canChoose = true}} - {{end}} - {{end}} - - {{if $canChoose}} - <a href="#" class="ui poping up icon re-request-review" data-is-checked="{{if eq .Type 4}}true{{else}}false{{end}}" data-content="{{ if eq .Type 4 }} {{$.i18n.Tr "repo.issues.remove_request_review"}} {{else}} {{$.i18n.Tr "repo.issues.re_request_review"}} {{end}}" data-issue-id="{{$.Issue.ID}}" data-id="{{.ReviewerID}}" data-update-url="{{$.RepoLink}}/issues/request_review"> + {{if .CanChange}} + <a href="#" class="ui poping up icon re-request-review {{if .Checked}}checked{{end}}" data-content="{{if .Checked}} {{$.i18n.Tr "repo.issues.remove_request_review"}} {{else}} {{$.i18n.Tr "repo.issues.re_request_review"}} {{end}}" data-issue-id="{{$.Issue.ID}}" data-id="{{.ItemID}}" data-update-url="{{$.RepoLink}}/issues/request_review"> {{svg "octicon-sync"}} </a> {{end}} - {{svg (printf "octicon-%s" .Type.Icon)}} + {{svg (printf "octicon-%s" .Review.Type.Icon)}} </span> </div> {{end}} |