From 3dbebf36b840fe3a56f19f3fae5b96606afde7c5 Mon Sep 17 00:00:00 2001 From: RhodeCode Admin Date: Thu, 15 Jul 2021 15:03:07 +0200 Subject: [PATCH] pull-requests: allow forced state change to repo admins too. --- rhodecode/apps/repository/views/repo_pull_requests.py | 3 ++- rhodecode/templates/pullrequests/pullrequest_show.mako | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/rhodecode/apps/repository/views/repo_pull_requests.py b/rhodecode/apps/repository/views/repo_pull_requests.py index fb1992d7..c5f57aa7 100644 --- a/rhodecode/apps/repository/views/repo_pull_requests.py +++ b/rhodecode/apps/repository/views/repo_pull_requests.py @@ -326,8 +326,9 @@ class RepoPullRequestsView(RepoAppView, DataGridAppView): _new_state = { 'created': PullRequest.STATE_CREATED, }.get(self.request.GET.get('force_state')) + can_force_state = c.is_super_admin or HasRepoPermissionAny('repository.admin')(c.repo_name) - if c.is_super_admin and _new_state: + if can_force_state and _new_state: with pull_request.set_state(PullRequest.STATE_UPDATING, final_state=_new_state): h.flash( _('Pull Request state was force changed to `{}`').format(_new_state), diff --git a/rhodecode/templates/pullrequests/pullrequest_show.mako b/rhodecode/templates/pullrequests/pullrequest_show.mako index 1ed75a78..04622ddd 100644 --- a/rhodecode/templates/pullrequests/pullrequest_show.mako +++ b/rhodecode/templates/pullrequests/pullrequest_show.mako @@ -274,11 +274,12 @@ % if c.state_progressing:

- ${_('Cannot show diff when pull request state is changing. Current progress state')}: ${c.pull_request.state} + ${_('Cannot show diff when pull request state is changing. Current progress state')}: ${c.pull_request.state}
+ ${_('Consider refreshing the page to check if the status transition was finished')}. - % if c.is_super_admin: + % if c.is_super_admin or h.HasRepoPermissionAny('repository.admin')(c.repo_name):
- If you think this is an error try forced state reset to created state. + ${_('If you think this is an error try ')}forced state reset to created state. % endif