Mercurial > kallithea
changeset 4358:068ca0afcf9f
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.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Fri, 18 Jul 2014 18:47:02 +0200 |
parents | c666a68e2a4d |
children | cfd9115db2a5 |
files | kallithea/controllers/pullrequests.py kallithea/templates/changeset/changeset_file_comment.html |
diffstat | 2 files changed, 4 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/controllers/pullrequests.py Fri Jul 18 18:47:02 2014 +0200 +++ b/kallithea/controllers/pullrequests.py Fri Jul 18 18:47:02 2014 +0200 @@ -584,15 +584,10 @@ ) 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()
--- a/kallithea/templates/changeset/changeset_file_comment.html Fri Jul 18 18:47:02 2014 +0200 +++ b/kallithea/templates/changeset/changeset_file_comment.html Fri Jul 18 18:47:02 2014 +0200 @@ -171,8 +171,8 @@ </span> %endfor %if is_pr and change_status: - <input id="save_close" type="checkbox" name="save_close" disabled="${'1' if cur_status in ['not_reviewed','under_review'] else ''}"> - <label id="save_close_label" for="save_close" class="${'disabled' if cur_status in ['not_reviewed','under_review'] else ''}">${_("Close (when approved or rejected)")}</label> + <input id="save_close" type="checkbox" name="save_close"> + <label id="save_close_label" for="save_close">${_("Close")}</label> %endif </div> %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){