##// END OF EJS Templates
pull-requests: allow super-admins to force change state of locked PRs....
marcink -
r4233:95c3d867 stable
parent child Browse files
Show More
@@ -275,6 +275,20 b' class RepoPullRequestsView(RepoAppView, '
275
275
276 c.state_progressing = pull_request.is_state_changing()
276 c.state_progressing = pull_request.is_state_changing()
277
277
278 _new_state = {
279 'created': PullRequest.STATE_CREATED,
280 }.get(self.request.GET.get('force_state'))
281 if c.is_super_admin and _new_state:
282 with pull_request.set_state(PullRequest.STATE_UPDATING, final_state=_new_state):
283 h.flash(
284 _('Pull Request state was force changed to `{}`').format(_new_state),
285 category='success')
286 Session().commit()
287
288 raise HTTPFound(h.route_path(
289 'pullrequest_show', repo_name=self.db_repo_name,
290 pull_request_id=pull_request_id))
291
278 version = self.request.GET.get('version')
292 version = self.request.GET.get('version')
279 from_version = self.request.GET.get('from_version') or version
293 from_version = self.request.GET.get('from_version') or version
280 merge_checks = self.request.GET.get('merge_checks')
294 merge_checks = self.request.GET.get('merge_checks')
@@ -3901,8 +3901,8 b' class _SetState(object):'
3901 self._current_state = None
3901 self._current_state = None
3902
3902
3903 def __enter__(self):
3903 def __enter__(self):
3904 log.debug('StateLock: entering set state context, setting state to: `%s`',
3904 log.debug('StateLock: entering set state context of pr %s, setting state to: `%s`',
3905 self._pr_state)
3905 self._pr, self._pr_state)
3906 self.set_pr_state(self._pr_state)
3906 self.set_pr_state(self._pr_state)
3907 return self
3907 return self
3908
3908
@@ -3912,8 +3912,9 b' class _SetState(object):'
3912 return None
3912 return None
3913
3913
3914 self.set_pr_state(self._org_state)
3914 self.set_pr_state(self._org_state)
3915 log.debug('StateLock: exiting set state context, setting state to: `%s`',
3915 log.debug('StateLock: exiting set state context of pr %s, setting state to: `%s`',
3916 self._org_state)
3916 self._pr, self._org_state)
3917
3917 @property
3918 @property
3918 def state(self):
3919 def state(self):
3919 return self._current_state
3920 return self._current_state
@@ -438,6 +438,11 b''
438
438
439 <h2 style="text-align: center">
439 <h2 style="text-align: center">
440 ${_('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>
440 ${_('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>
441
442 % if c.is_super_admin:
443 <br/>
444 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.
445 % endif
441 </h2>
446 </h2>
442
447
443 % else:
448 % else:
General Comments 0
You need to be logged in to leave comments. Login now