diff --git a/kallithea/model/changeset_status.py b/kallithea/model/changeset_status.py --- a/kallithea/model/changeset_status.py +++ b/kallithea/model/changeset_status.py @@ -112,7 +112,7 @@ class ChangesetStatusModel(BaseModel): return str(status.status) if status else ChangesetStatus.DEFAULT return status - def set_status(self, repo, status, user, comment=None, revision=None, + def set_status(self, repo, status, user, comment, revision=None, pull_request=None, dont_allow_on_closed_pull_request=False): """ Creates new status for changeset or updates the old ones bumping their @@ -130,15 +130,6 @@ class ChangesetStatusModel(BaseModel): repo = self._get_repo(repo) q = ChangesetStatus.query() - if not comment: - from kallithea.model.comment import ChangesetCommentsModel - comment = ChangesetCommentsModel().create( - text=u'Auto status change to %s' % (ChangesetStatus.get_status_lbl(status)), - repo=repo, - user=user, - pull_request=pull_request, - send_email=False - ) if revision: q = q.filter(ChangesetStatus.repo == repo) q = q.filter(ChangesetStatus.revision == revision) diff --git a/kallithea/model/pull_request.py b/kallithea/model/pull_request.py --- a/kallithea/model/pull_request.py +++ b/kallithea/model/pull_request.py @@ -91,10 +91,19 @@ class PullRequestModel(BaseModel): Session().flush() #reset state to under-review - ChangesetStatusModel().set_status( + from kallithea.model.comment import ChangesetCommentsModel + comment = ChangesetCommentsModel().create( + text=u'Auto status change to %s' % (ChangesetStatus.get_status_lbl(ChangesetStatus.STATUS_UNDER_REVIEW)), repo=org_repo, - status=ChangesetStatus.STATUS_UNDER_REVIEW, user=new.author, + pull_request=new, + send_email=False + ) + ChangesetStatusModel().set_status( + org_repo, + ChangesetStatus.STATUS_UNDER_REVIEW, + new.author, + comment, pull_request=new ) self.__add_reviewers(new, reviewers)