##// END OF EJS Templates
pull-requests: allow forced state change to repo admins too.
super-admin -
r4710:97a223d9 stable
parent child Browse files
Show More
@@ -326,8 +326,9 b' class RepoPullRequestsView(RepoAppView, '
326 _new_state = {
326 _new_state = {
327 'created': PullRequest.STATE_CREATED,
327 'created': PullRequest.STATE_CREATED,
328 }.get(self.request.GET.get('force_state'))
328 }.get(self.request.GET.get('force_state'))
329 can_force_state = c.is_super_admin or HasRepoPermissionAny('repository.admin')(c.repo_name)
329
330
330 if c.is_super_admin and _new_state:
331 if can_force_state and _new_state:
331 with pull_request.set_state(PullRequest.STATE_UPDATING, final_state=_new_state):
332 with pull_request.set_state(PullRequest.STATE_UPDATING, final_state=_new_state):
332 h.flash(
333 h.flash(
333 _('Pull Request state was force changed to `{}`').format(_new_state),
334 _('Pull Request state was force changed to `{}`').format(_new_state),
@@ -274,11 +274,12 b''
274 % if c.state_progressing:
274 % if c.state_progressing:
275
275
276 <h2 style="text-align: center">
276 <h2 style="text-align: center">
277 ${_('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>
277 ${_('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><br/>
278 ${_('Consider refreshing the page to check if the status transition was finished')}.
278
279
279 % if c.is_super_admin:
280 % if c.is_super_admin or h.HasRepoPermissionAny('repository.admin')(c.repo_name):
280 <br/>
281 <br/>
281 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.
282 ${_('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.
282 % endif
283 % endif
283 </h2>
284 </h2>
284
285
General Comments 0
You need to be logged in to leave comments. Login now