aboutsummaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorDavid Svantesson <davidsvantesson@gmail.com>2020-01-09 02:47:45 +0100
committerzeripath <art27@cantab.net>2020-01-09 01:47:45 +0000
commit25531c71a78b98af91f25d5e6eaa362e5fc54a86 (patch)
tree3dc44abba51f55f66020755d31fa909a9c56990e /templates
parent5b2d9333f1d06a15f11906b39c4867cc5d1c9448 (diff)
downloadgitea-25531c71a78b98af91f25d5e6eaa362e5fc54a86.tar.gz
gitea-25531c71a78b98af91f25d5e6eaa362e5fc54a86.zip
Mark PR reviews as stale at push and allow to dismiss stale approvals (#9532)
Fix #5997. If a push causes the patch/diff of a PR towards target branch to change, all existing reviews for the PR will be set and shown as stale. New branch protection option to dismiss stale approvals are added. To show that a review is not based on the latest PR changes, an hourglass is shown
Diffstat (limited to 'templates')
-rw-r--r--templates/repo/diff/comment_form.tmpl1
-rw-r--r--templates/repo/diff/new_review.tmpl1
-rw-r--r--templates/repo/issue/view_content/pull.tmpl5
-rw-r--r--templates/repo/settings/protected_branch.tmpl8
4 files changed, 15 insertions, 0 deletions
diff --git a/templates/repo/diff/comment_form.tmpl b/templates/repo/diff/comment_form.tmpl
index 573e7d4638..822b1e54f6 100644
--- a/templates/repo/diff/comment_form.tmpl
+++ b/templates/repo/diff/comment_form.tmpl
@@ -4,6 +4,7 @@
{{end}}
<form class="ui form {{if $.hidden}}hide comment-form comment-form-reply{{end}}" action="{{$.root.Issue.HTMLURL}}/files/reviews/comments" method="post">
{{$.root.CsrfTokenHtml}}
+ <input type="hidden" name="latest_commit_id" value="{{$.root.AfterCommitID}}"/>
<input type="hidden" name="side" value="{{if $.Side}}{{$.Side}}{{end}}">
<input type="hidden" name="line" value="{{if $.Line}}{{$.Line}}{{end}}">
<input type="hidden" name="path" value="{{if $.File}}{{$.File}}{{end}}">
diff --git a/templates/repo/diff/new_review.tmpl b/templates/repo/diff/new_review.tmpl
index 68d8f893f2..4981c9ef48 100644
--- a/templates/repo/diff/new_review.tmpl
+++ b/templates/repo/diff/new_review.tmpl
@@ -7,6 +7,7 @@
<div class="ui clearing segment">
<form class="ui form" action="{{.Link}}/reviews/submit" method="post">
{{.CsrfTokenHtml}}
+ <input type="hidden" name="commit_id" value="{{.AfterCommitID}}"/>
<i class="ui right floated link icon close"></i>
<div class="header">
{{$.i18n.Tr "repo.diff.review.header"}}
diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl
index 2dc76dcf2e..b1e6feeba0 100644
--- a/templates/repo/issue/view_content/pull.tmpl
+++ b/templates/repo/issue/view_content/pull.tmpl
@@ -13,6 +13,11 @@
{{else}}grey{{end}}">
<span class="octicon octicon-{{.Type.Icon}}"></span>
</span>
+ {{if .Stale}}
+ <span class="type-icon text grey">
+ <i class="octicon icon fa-hourglass-end"></i>
+ </span>
+ {{end}}
<a class="ui avatar image" href="{{.Reviewer.HomeLink}}">
<img src="{{.Reviewer.RelAvatarLink}}">
</a>
diff --git a/templates/repo/settings/protected_branch.tmpl b/templates/repo/settings/protected_branch.tmpl
index bf74a12330..c6701ce8a9 100644
--- a/templates/repo/settings/protected_branch.tmpl
+++ b/templates/repo/settings/protected_branch.tmpl
@@ -211,6 +211,14 @@
<p class="help">{{.i18n.Tr "repo.settings.block_rejected_reviews_desc"}}</p>
</div>
</div>
+ <div class="field">
+ <div class="ui checkbox">
+ <input name="dismiss_stale_approvals" type="checkbox" {{if .Branch.DismissStaleApprovals}}checked{{end}}>
+ <label for="dismiss_stale_approvals">{{.i18n.Tr "repo.settings.dismiss_stale_approvals"}}</label>
+ <p class="help">{{.i18n.Tr "repo.settings.dismiss_stale_approvals_desc"}}</p>
+ </div>
+ </div>
+
</div>
<div class="ui divider"></div>