Mercurial > kallithea
changeset 7433:68f2eb1bec8c
controllers: inline changeset.create_comment
As changeset.create_comment is now only used from
changeset.create_cs_pr_comment (used from pullrequests controller as well),
there is no need to have it as a separate method.
author | Thomas De Schampheleire <thomas.de_schampheleire@nokia.com> |
---|---|
date | Sat, 17 Nov 2018 21:31:08 +0100 |
parents | 8d2af331205a |
children | 901a5f2f3530 |
files | kallithea/controllers/changeset.py |
diffstat | 1 files changed, 8 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/controllers/changeset.py Fri Nov 16 22:20:32 2018 +0100 +++ b/kallithea/controllers/changeset.py Sat Nov 17 21:31:08 2018 +0100 @@ -166,26 +166,6 @@ return h.link_to(icon, h.url.current(**params), title=lbl, **{'data-toggle': 'tooltip'}) -# Could perhaps be nice to have in the model but is too high level ... -def create_comment(text, status, f_path, line_no, revision=None, pull_request_id=None, closing_pr=None): - """Comment functionality shared between changesets and pullrequests""" - f_path = f_path or None - line_no = line_no or None - - comment = ChangesetCommentsModel().create( - text=text, - repo=c.db_repo.repo_id, - author=request.authuser.user_id, - revision=revision, - pull_request=pull_request_id, - f_path=f_path, - line_no=line_no, - status_change=ChangesetStatus.get_status_lbl(status) if status else None, - closing_pr=closing_pr, - ) - - return comment - def create_cs_pr_comment(repo_name, revision=None, pull_request=None, allowed_to_change_status=True): assert request.environ.get('HTTP_X_PARTIAL_XHR') if pull_request: @@ -226,13 +206,15 @@ text = request.POST.get('text', '').strip() - comment = create_comment( - text, - status, + comment = ChangesetCommentsModel().create( + text=text, + repo=c.db_repo.repo_id, + author=request.authuser.user_id, revision=revision, - pull_request_id=pull_request_id, - f_path=f_path, - line_no=line_no, + pull_request=pull_request_id, + f_path=f_path or None, + line_no=line_no or None, + status_change=ChangesetStatus.get_status_lbl(status) if status else None, closing_pr=close_pr, )