Changeset - 068ca0afcf9f
[Not reviewed]
default
0 2 0
Mads Kiilerich - 11 years ago 2014-07-18 18:47:02
madski@unity3d.com
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.
2 files changed with 4 insertions and 29 deletions:
0 comments (0 inline, 0 general)
kallithea/controllers/pullrequests.py
Show inline comments
 
@@ -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()
 

	
kallithea/templates/changeset/changeset_file_comment.html
Show inline comments
 
@@ -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){
0 comments (0 inline, 0 general)