diff options
author | Lanre Adelowo <adelowomailbox@gmail.com> | 2018-08-20 06:04:01 +0100 |
---|---|---|
committer | Jonas Franz <info@jonasfranz.software> | 2018-08-20 07:04:01 +0200 |
commit | 6c1a31ffaaddf8ced7c30bf5b1e6e82d66f8c6ee (patch) | |
tree | d9a744f9495547f626d591334bc78bc86b8dfc50 /templates | |
parent | fa93857117307a54e6e3feb4a80de6d7d19ccbed (diff) | |
download | gitea-6c1a31ffaaddf8ced7c30bf5b1e6e82d66f8c6ee.tar.gz gitea-6c1a31ffaaddf8ced7c30bf5b1e6e82d66f8c6ee.zip |
User shouldn't be able to approve or reject his/her own PR (#4729)
* Make sure author cannot reject/approve their own PR
* Disable buttons in templates too
* Remove unneccessary if check since the switch below catches it
* Fix IsOwner check
* Update template and remove new template variable
* Add alert template and redirect to diff page on review failure
* Redirect to files diff as a little update to #4632
Diffstat (limited to 'templates')
-rw-r--r-- | templates/repo/diff/new_review.tmpl | 6 | ||||
-rw-r--r-- | templates/repo/pulls/files.tmpl | 1 |
2 files changed, 4 insertions, 3 deletions
diff --git a/templates/repo/diff/new_review.tmpl b/templates/repo/diff/new_review.tmpl index 2b49ac7296..68d8f893f2 100644 --- a/templates/repo/diff/new_review.tmpl +++ b/templates/repo/diff/new_review.tmpl @@ -16,11 +16,11 @@ placeholder="{{$.i18n.Tr "repo.diff.review.placeholder"}}"></textarea> </div> <div class="ui divider"></div> - <button type="submit" name="type" value="approve" + <button type="submit" name="type" value="approve" {{ if and $.IsSigned ($.Issue.IsPoster $.SignedUser.ID) }} disabled {{ end }} class="ui submit green tiny button btn-submit">{{$.i18n.Tr "repo.diff.review.approve"}}</button> <button type="submit" name="type" value="comment" - class="ui submit tiny basic button btn-submit">{{$.i18n.Tr "repo.diff.review.comment"}}</button> - <button type="submit" name="type" value="reject" + class="ui submit tiny basic button btn-submit">{{$.i18n.Tr "repo.diff.review.comment"}}</button> + <button type="submit" name="type" value="reject" {{ if and $.IsSigned ($.Issue.IsPoster $.SignedUser.ID) }} disabled {{ end }} class="ui submit red tiny button btn-submit">{{$.i18n.Tr "repo.diff.review.reject"}}</button> </form> </div> diff --git a/templates/repo/pulls/files.tmpl b/templates/repo/pulls/files.tmpl index 7663788c68..fb46919f88 100644 --- a/templates/repo/pulls/files.tmpl +++ b/templates/repo/pulls/files.tmpl @@ -11,6 +11,7 @@ <div class="ui divider"></div> {{template "repo/issue/view_title" .}} {{template "repo/pulls/tab_menu" .}} + {{template "base/alert" .}} <div class="ui bottom attached tab pull segment active"> {{template "repo/diff/box" .}} </div> |