diff --git a/pagure/forms.py b/pagure/forms.py index 99a3fa9..2bbfe62 100644 --- a/pagure/forms.py +++ b/pagure/forms.py @@ -206,6 +206,7 @@ class AddPullRequestCommentForm(wtf.Form): filename = wtforms.HiddenField('file changed') row = wtforms.HiddenField('row') requestid = wtforms.HiddenField('requestid') + tree_id = wtforms.HiddenField('treeid') comment = wtforms.TextAreaField( 'Comment*', [wtforms.validators.Required()] diff --git a/pagure/templates/pull_request.html b/pagure/templates/pull_request.html index 1123f81..49d650f 100644 --- a/pagure/templates/pull_request.html +++ b/pagure/templates/pull_request.html @@ -296,7 +296,8 @@ filename=patch_new_file_path, commit=patch_new_id, prequest=pull_request, - index=loop.index)}} + index=loop.index, + tree=diff_commits[0].tree.id)}} {% endautoescape %} @@ -667,10 +668,14 @@ function setup_reply_btns() { var row = $( this ).attr('data-row'); var commit = $( this ).attr('data-commit'); var filename = $( this ).attr('data-filename'); + var tree_id = $( this ).attr('data-tree'); var url = "{{ url_for( 'pull_request_add_comment', username=username, repo=repo.name, requestid=requestid, commit='', filename='', row='') }}".slice(0, -2); - url = url + commit + '/' + filename + '/' + row; + url = url + commit + '/' + filename + '/' + row + if (tree_id) { + url += '?tree_id=' + tree_id; + } var rowid = $(this).prev().find('a').attr('id'); var table = $( this ).parent().parent(); var nextid = rowid.replace('_' + row, '_' + (Number(row) + 1)); diff --git a/pagure/templates/pull_request_comment.html b/pagure/templates/pull_request_comment.html index 37783f6..882bba8 100644 --- a/pagure/templates/pull_request_comment.html +++ b/pagure/templates/pull_request_comment.html @@ -4,7 +4,8 @@
diff --git a/pagure/ui/fork.py b/pagure/ui/fork.py index b1a15e7..b992ff8 100644 --- a/pagure/ui/fork.py +++ b/pagure/ui/fork.py @@ -451,12 +451,14 @@ def pull_request_add_comment( flask.abort(404, 'Pull-request not found') is_js = flask.request.args.get('js', False) + tree_id = flask.request.args.get('tree_id') or None form = pagure.forms.AddPullRequestCommentForm() form.commit.data = commit form.filename.data = filename form.requestid.data = requestid form.row.data = row + form.tree_id.data = tree_id if form.validate_on_submit(): comment = form.comment.data @@ -466,6 +468,7 @@ def pull_request_add_comment( SESSION, request=request, commit=commit, + tree_id=tree_id, filename=filename, row=row, comment=comment, @@ -498,6 +501,7 @@ def pull_request_add_comment( repo=repo, username=username, commit=commit, + tree_id=tree_id, filename=filename, row=row, form=form,