# HG changeset patch # User Mads Kiilerich # Date 2014-07-18 18:47:02 # Node ID 068ca0afcf9f9b1eed4997205f0fd413fbcd653d # Parent c666a68e2a4d68f3a257658400755c0a47ce8c91 pull requests: allow closing of PRs in all states - undo #677 There can be reasons to close a PR without approving or rejecting it - especially when approving or rejecting a PR overwrites the "review status" of all changesets in it. If some code for some reason is interested in PRs that has been closed as approved or rejected then that is what they should look for ... even though that is very hard with the current data model. diff --git a/kallithea/controllers/pullrequests.py b/kallithea/controllers/pullrequests.py --- a/kallithea/controllers/pullrequests.py +++ b/kallithea/controllers/pullrequests.py @@ -584,15 +584,10 @@ class PullrequestsController(BaseRepoCon ) if close_pr: - if status in ['rejected', 'approved']: - PullRequestModel().close_pull_request(pull_request_id) - action_logger(self.authuser, + PullRequestModel().close_pull_request(pull_request_id) + action_logger(self.authuser, 'user_closed_pull_request:%s' % pull_request_id, c.db_repo, self.ip_addr, self.sa) - else: - h.flash(_('Closing pull request on other statuses than ' - 'rejected or approved forbidden'), - category='warning') Session().commit() diff --git a/kallithea/templates/changeset/changeset_file_comment.html b/kallithea/templates/changeset/changeset_file_comment.html --- a/kallithea/templates/changeset/changeset_file_comment.html +++ b/kallithea/templates/changeset/changeset_file_comment.html @@ -171,8 +171,8 @@ %endfor %if is_pr and change_status: - - + + %endif %endif @@ -199,26 +199,6 @@ YUE.onDOMReady(function () { MentionsAutoComplete('text', 'mentions_container', _USERS_AC_DATA, _GROUPS_AC_DATA); - var set_close_button_state = function(cur_val){ - %if is_pr and change_status: - if (cur_val == 'approved' || cur_val == 'rejected') { - YUD.removeClass('save_close_label', 'disabled'); - YUD.get('save_close').disabled = false; - }else{ - YUD.addClass('save_close_label', 'disabled'); - YUD.get('save_close').disabled = true; - YUD.get('save_close').checked = false; - } - %endif - } - YUE.on(YUQ('.status_change_radio'), 'change',function(e){ - var val = e.currentTarget.value; - set_close_button_state(val); - }) - // if currect checked status is approved or rejected we should unlock the close button - var cur_val = YUQ('.status_change_radio[checked]')[0].value; - set_close_button_state(cur_val) - YUE.on('preview-btn', 'click', function(e){ var _text = YUD.get('text').value; if(!_text){