From 8be3e439c2b3a90fcb639b732008486b85314b8d Mon Sep 17 00:00:00 2001 From: 赵智超 <1012112796@qq.com> Date: Tue, 13 Oct 2020 03:55:13 +0800 Subject: 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 Co-authored-by: Lauris BH Co-authored-by: Andrew Thornton --- templates/repo/issue/view_content/comments.tmpl | 18 ++++-- templates/repo/issue/view_content/pull.tmpl | 54 ++++++++--------- templates/repo/issue/view_content/sidebar.tmpl | 81 +++++++++++-------------- 3 files changed, 72 insertions(+), 81 deletions(-) (limited to 'templates') 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 @@ {{.Poster.GetDisplayName}} - {{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}} 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 }}

{{$.i18n.Tr "repo.issues.review.reviewers"}}

{{range .PullReviewers}} - {{ $createdStr:= TimeSinceUnix .UpdatedUnix $.Lang }} + {{ $createdStr:= TimeSinceUnix .Review.UpdatedUnix $.Lang }}
- - - - {{.Reviewer.Name}} - {{if eq .Type 1}} + {{if .User}} + + + + {{end}} + + {{if .User}} + {{.User.Name}} + {{else if .Team}} + {{$.Issue.Repo.OwnerName}}/{{.Team.Name}} + {{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 @@
- {{if .Stale}} + {{if .Review.Stale}} {{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 }} - + {{if .CanChange }} + {{svg "octicon-sync"}} {{end}} - {{svg (printf "octicon-%s" .Type.Icon)}} + {{svg (printf "octicon-%s" .Review.Type.Icon)}}
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 }} -
@@ -59,30 +53,23 @@
{{range .PullReviewers}}
-  {{.Reviewer.GetDisplayName}} -  {{.User.GetDisplayName}} + {{else if .Team}} + {{svg "octicon-people" 16 "teamavatar"}}{{$.Issue.Repo.OwnerName}}/{{.Team.Name}} + {{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}} - + {{if .CanChange}} + {{svg "octicon-sync"}} {{end}} - {{svg (printf "octicon-%s" .Type.Icon)}} + {{svg (printf "octicon-%s" .Review.Type.Icon)}}
{{end}} -- cgit v1.2.3