pull-requests: allow super-admins to force change state of locked PRs.
- because we still get into that state in some cases, we just create a helper to unlock it easier. just for super-admins.
This commit is contained in:
parent
3c0a8c8b19
commit
8c09a544c1
3 changed files with 24 additions and 4 deletions
|
|
@ -275,6 +275,20 @@ class RepoPullRequestsView(RepoAppView, DataGridAppView):
|
|||
|
||||
c.state_progressing = pull_request.is_state_changing()
|
||||
|
||||
_new_state = {
|
||||
'created': PullRequest.STATE_CREATED,
|
||||
}.get(self.request.GET.get('force_state'))
|
||||
if c.is_super_admin 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),
|
||||
category='success')
|
||||
Session().commit()
|
||||
|
||||
raise HTTPFound(h.route_path(
|
||||
'pullrequest_show', repo_name=self.db_repo_name,
|
||||
pull_request_id=pull_request_id))
|
||||
|
||||
version = self.request.GET.get('version')
|
||||
from_version = self.request.GET.get('from_version') or version
|
||||
merge_checks = self.request.GET.get('merge_checks')
|
||||
|
|
|
|||
|
|
@ -3901,8 +3901,8 @@ class _SetState(object):
|
|||
self._current_state = None
|
||||
|
||||
def __enter__(self):
|
||||
log.debug('StateLock: entering set state context, setting state to: `%s`',
|
||||
self._pr_state)
|
||||
log.debug('StateLock: entering set state context of pr %s, setting state to: `%s`',
|
||||
self._pr, self._pr_state)
|
||||
self.set_pr_state(self._pr_state)
|
||||
return self
|
||||
|
||||
|
|
@ -3912,8 +3912,9 @@ class _SetState(object):
|
|||
return None
|
||||
|
||||
self.set_pr_state(self._org_state)
|
||||
log.debug('StateLock: exiting set state context, setting state to: `%s`',
|
||||
self._org_state)
|
||||
log.debug('StateLock: exiting set state context of pr %s, setting state to: `%s`',
|
||||
self._pr, self._org_state)
|
||||
|
||||
@property
|
||||
def state(self):
|
||||
return self._current_state
|
||||
|
|
|
|||
|
|
@ -438,6 +438,11 @@
|
|||
|
||||
<h2 style="text-align: center">
|
||||
${_('Cannot show diff when pull request state is changing. Current progress state')}: <span class="tag tag-merge-state-${c.pull_request.state}">${c.pull_request.state}</span>
|
||||
|
||||
% if c.is_super_admin:
|
||||
<br/>
|
||||
If you think this is an error try <a href="${h.current_route_path(request, force_state='created')}">forced state reset</a> to <span class="tag tag-merge-state-created">created</span> state.
|
||||
% endif
|
||||
</h2>
|
||||
|
||||
% else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue