Changeset - 91492a72b2dc
[Not reviewed]
beta
0 3 0
Marcin Kuzminski - 13 years ago 2012-12-14 02:27:48
marcin@python-works.com
implements #677: Don't allow to close pull requests when they are under-review state
3 files changed with 23 insertions and 6 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/pullrequests.py
Show inline comments
 
@@ -424,28 +424,33 @@ class PullrequestsController(BaseRepoCon
 
            ChangesetStatusModel().set_status(
 
                c.rhodecode_db_repo.repo_id,
 
                status,
 
                c.rhodecode_user.user_id,
 
                comm,
 
                pull_request=pull_request_id
 
            )
 
        action_logger(self.rhodecode_user,
 
                      'user_commented_pull_request:%s' % pull_request_id,
 
                      c.rhodecode_db_repo, self.ip_addr, self.sa)
 

	
 
        if request.POST.get('save_close'):
 
            PullRequestModel().close_pull_request(pull_request_id)
 
            action_logger(self.rhodecode_user,
 
                      'user_closed_pull_request:%s' % pull_request_id,
 
                      c.rhodecode_db_repo, self.ip_addr, self.sa)
 
            if status in ['rejected', 'approved']:
 
                PullRequestModel().close_pull_request(pull_request_id)
 
                action_logger(self.rhodecode_user,
 
                          'user_closed_pull_request:%s' % pull_request_id,
 
                          c.rhodecode_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()
 

	
 
        if not request.environ.get('HTTP_X_PARTIAL_XHR'):
 
            return redirect(h.url('pullrequest_show', repo_name=repo_name,
 
                                  pull_request_id=pull_request_id))
 

	
 
        data = {
 
           'target_id': h.safeid(h.safe_unicode(request.POST.get('f_path'))),
 
        }
 
        if comm:
 
            c.co = comm
rhodecode/public/css/style.css
Show inline comments
 
@@ -3610,24 +3610,28 @@ div.gravatar img {
 
  background-image: -khtml-gradient(linear, left top, left bottom, from(#62c462), to(#57a957));
 
  background-image: -moz-linear-gradient(top, #62c462, #57a957);
 
  background-image: -ms-linear-gradient(top, #62c462, #57a957);
 
  background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #62c462), color-stop(100%, #57a957));
 
  background-image: -webkit-linear-gradient(top, #62c462, #57a957);
 
  background-image: -o-linear-gradient(top, #62c462, #57a957);
 
  background-image: linear-gradient(top, #62c462, #57a957);
 
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#62c462', endColorstr='#57a957', GradientType=0);
 
  border-color: #57a957 #57a957 #3d773d;
 
  border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);	
 
}
 
 
.ui-btn.blue.hidden{
 
	display: none;
 
}
 
 
.ui-btn.active{
 
    font-weight: bold;
 
}
 
 
ins,div.options a:hover {
 
	text-decoration: none;
 
}
 
 
img,
 
#header #header-inner #quick li a:hover span.normal,
 
#header #header-inner #quick li ul li.last,
 
#content div.box div.form div.fields div.field div.textarea table td table td a,
rhodecode/templates/changeset/changeset_file_comment.html
Show inline comments
 
@@ -118,47 +118,55 @@
 
        <strong>${_('Leave a comment')}</strong>
 
        <div class="clearfix">
 
            <div class="comment-help">
 
                ${(_('Comments parsed using %s syntax with %s support.') % (('<a href="%s">RST</a>' % h.url('rst_help')),
 
          		'<span style="color:#003367" class="tooltip" title="%s">@mention</span>' %
 
          		_('Use @username inside this text to send notification to this RhodeCode user')))|n}
 
                | <label for="show_changeset_status_box" class="tooltip" title="${_('Check this to change current status of code-review for this changeset')}"> ${_('change status')}</label>
 
                  <input style="vertical-align: bottom;margin-bottom:-2px" id="show_changeset_status_box" type="checkbox" name="change_changeset_status" />
 
            </div>
 
            <div id="status_block_container" class="status-block" style="display:none">
 
                %for status,lbl in c.changeset_statuses:
 
                    <div class="">
 
                        <img src="${h.url('/images/icons/flag_status_%s.png' % status)}" /> <input ${'checked="checked"' if status == cur_status else ''}" type="radio" name="changeset_status" id="${status}" value="${status}"> 
 
                        <img src="${h.url('/images/icons/flag_status_%s.png' % status)}" /> <input ${'checked="checked"' if status == cur_status else ''}" type="radio" class="status_change_radio" name="changeset_status" id="${status}" value="${status}"> 
 
                        <label for="${status}">${lbl}</label>
 
                    </div>
 
                %endfor
 
            </div>
 
            <div class="mentions-container" id="mentions_container"></div>
 
             ${h.textarea('text')}
 
        </div>
 
        <div class="comment-button">
 
        ${h.submit('save', _('Comment'), class_="ui-btn large")}
 
        %if close_btn:
 
           ${h.submit('save_close', _('Comment and close'), class_='ui-btn blue large')}
 
           ${h.submit('save_close', _('Comment and close'), class_='ui-btn blue large %s' % 'hidden' if cur_status in ['not_reviewd','under_review'] else '')}
 
        %endif
 
        </div>
 
        ${h.end_form()}
 
    </div>
 
    %endif
 
</div>
 
<script>
 
YUE.onDOMReady(function () {
 
   MentionsAutoComplete('text', 'mentions_container', _USERS_AC_DATA, _GROUPS_AC_DATA);
 

	
 
   // changeset status box listener
 
   YUE.on(YUD.get('show_changeset_status_box'),'change',function(e){
 
       if(e.currentTarget.checked){
 
           YUD.setStyle('status_block_container','display','');
 
       }
 
       else{
 
           YUD.setStyle('status_block_container','display','none');
 
       }
 
   })
 
   YUE.on(YUQ('.status_change_radio'), 'change',function(e){
 
	   var val = e.currentTarget.value;
 
	   if (val == 'approved' || val == 'rejected') {
 
		   YUD.removeClass('save_close', 'hidden');
 
	   }else{
 
		   YUD.addClass('save_close', 'hidden');
 
	   }
 
   })
 

	
 
});
 
</script>
 
</%def>
0 comments (0 inline, 0 general)