Changeset - 579110ca5178
[Not reviewed]
default
0 3 0
Jan Heylen - 11 years ago 2015-05-04 21:07:37
heyleke@gmail.com
changeset/pullrequest controller: refactor some old variable naming

c.co is a bit cryptic, use the full name c.comment
comm sounds like 'communication', use the full name, comment

tested by adding a single comment on a changeset/pullreques
and running:
* the kallithea/tests/functional/test_changeset_comments.py test
3 files changed with 10 insertions and 10 deletions:
0 comments (0 inline, 0 general)
kallithea/controllers/changeset.py
Show inline comments
 
@@ -348,13 +348,13 @@ class ChangesetController(BaseRepoContro
 
                                   'repository.admin')
 
    @jsonify
 
    def comment(self, repo_name, revision):
 
        status = request.POST.get('changeset_status')
 
        text = request.POST.get('text', '').strip()
 

	
 
        c.co = comm = ChangesetCommentsModel().create(
 
        c.comment = comment = ChangesetCommentsModel().create(
 
            text=text,
 
            repo=c.db_repo.repo_id,
 
            user=c.authuser.user_id,
 
            revision=revision,
 
            f_path=request.POST.get('f_path'),
 
            line_no=request.POST.get('line'),
 
@@ -370,13 +370,13 @@ class ChangesetController(BaseRepoContro
 

	
 
            try:
 
                ChangesetStatusModel().set_status(
 
                    c.db_repo.repo_id,
 
                    status,
 
                    c.authuser.user_id,
 
                    comm,
 
                    comment,
 
                    revision=revision,
 
                    dont_allow_on_closed_pull_request=True
 
                )
 
            except StatusChangeOnClosedPullRequestError:
 
                log.error(traceback.format_exc())
 
                msg = _('Changing status on a changeset associated with '
 
@@ -394,14 +394,14 @@ class ChangesetController(BaseRepoContro
 
            return redirect(h.url('changeset_home', repo_name=repo_name,
 
                                  revision=revision))
 
        #only ajax below
 
        data = {
 
           'target_id': h.safeid(h.safe_unicode(request.POST.get('f_path'))),
 
        }
 
        if comm:
 
            data.update(comm.get_dict())
 
        if comment:
 
            data.update(comment.get_dict())
 
            data.update({'rendered_text':
 
                         render('changeset/changeset_comment_block.html')})
 

	
 
        return data
 

	
 
    @LoginRequired()
kallithea/controllers/pullrequests.py
Show inline comments
 
@@ -697,13 +697,13 @@ class PullrequestsController(BaseRepoCon
 
            status = request.POST.get('changeset_status')
 
            close_pr = request.POST.get('save_close')
 
        text = request.POST.get('text', '').strip()
 
        if close_pr:
 
            text = _('Closing.') + '\n' + text
 

	
 
        comm = ChangesetCommentsModel().create(
 
        comment = ChangesetCommentsModel().create(
 
            text=text,
 
            repo=c.db_repo.repo_id,
 
            user=c.authuser.user_id,
 
            pull_request=pull_request_id,
 
            f_path=request.POST.get('f_path'),
 
            line_no=request.POST.get('line'),
 
@@ -720,13 +720,13 @@ class PullrequestsController(BaseRepoCon
 
            # get status if set !
 
            if status:
 
                ChangesetStatusModel().set_status(
 
                    c.db_repo.repo_id,
 
                    status,
 
                    c.authuser.user_id,
 
                    comm,
 
                    comment,
 
                    pull_request=pull_request_id
 
                )
 

	
 
            if close_pr:
 
                PullRequestModel().close_pull_request(pull_request_id)
 
                action_logger(self.authuser,
 
@@ -738,15 +738,15 @@ class PullrequestsController(BaseRepoCon
 
        if not request.environ.get('HTTP_X_PARTIAL_XHR'):
 
            return redirect(pull_request.url())
 

	
 
        data = {
 
           'target_id': h.safeid(h.safe_unicode(request.POST.get('f_path'))),
 
        }
 
        if comm:
 
            c.co = comm
 
            data.update(comm.get_dict())
 
        if comment:
 
            c.comment = comment
 
            data.update(comment.get_dict())
 
            data.update({'rendered_text':
 
                         render('changeset/changeset_comment_block.html')})
 

	
 
        return data
 

	
 
    @LoginRequired()
kallithea/templates/changeset/changeset_comment_block.html
Show inline comments
 
## this is a dummy html file for partial rendering on server and sending
 
## generated output via ajax after comment submit
 
<%namespace name="comment" file="/changeset/changeset_file_comment.html"/>
 
${comment.comment_block(c.co)}
 
${comment.comment_block(c.comment)}
0 comments (0 inline, 0 general)