diff --git a/pagure/forms.py b/pagure/forms.py index 2bbfe62..c0a1f25 100644 --- a/pagure/forms.py +++ b/pagure/forms.py @@ -92,6 +92,8 @@ class RequestPullForm(wtf.Form): 'Title*', [wtforms.validators.Required()] ) + initial_comment = wtforms.TextAreaField( + 'Initial Comment', [wtforms.validators.Optional()]) class RemoteRequestPullForm(RequestPullForm): diff --git a/pagure/templates/pull_request.html b/pagure/templates/pull_request.html index 4a31c60..8757a28 100644 --- a/pagure/templates/pull_request.html +++ b/pagure/templates/pull_request.html @@ -149,6 +149,7 @@ {% endif %} {{ render_bootstrap_field(form.title) }} + {{ render_bootstrap_field(form.initial_comment)}}

{{ form.csrf_token }} diff --git a/pagure/ui/fork.py b/pagure/ui/fork.py index b992ff8..9931c8b 100644 --- a/pagure/ui/fork.py +++ b/pagure/ui/fork.py @@ -946,6 +946,19 @@ def new_request_pull(repo, branch_to, branch_from, username=None): user=flask.g.fas_user.username, requestfolder=APP.config['REQUESTS_FOLDER'], ) + + if not form.initial_comment.data == '': + pagure.lib.add_pull_request_comment( + SESSION, + request=request, + commit=None, + filename=None, + row=None, + comment=form.initial_comment.data, + user=flask.g.fas_user.username, + requestfolder=APP.config['REQUESTS_FOLDER'], + ) + try: SESSION.commit() except SQLAlchemyError as err: # pragma: no cover