#3680 fix regression where PR comment was not filled in anymore
Merged 2 years ago by pingou. Opened 2 years ago by ryanlerch.
ryanlerch/pagure fix-autofill-pr-comment  into  master

@@ -194,7 +194,9 @@ 

          </div>

          <div class="card-body">

              <textarea class="form-control" rows=8 id="initial_comment" name="initial_comment"

-             placeholder="Describe your changes" tabindex=1></textarea>

+             placeholder="Describe your changes" tabindex=1>

+             {{- form.initial_comment.data if form.initial_comment.data else '' -}}

+             </textarea>

            {% if form.initial_comment.errors %}

            <span class="float-right text-danger">

              <small>

@@ -196,7 +196,7 @@ 

                  'refs/heads/%s' % branch_from,

                  author,

                  committer,

-                 'A commit on branch %s' % branch_from,

+                 'A commit on branch %s\n\nMore information' % branch_from,

                  tree,

                  [first_commit.oid.hex]

              )
@@ -1103,6 +1103,7 @@ 

  Subject: A commit on branch feature

  

  

+ More information

  ---

  

  diff --git a/.gitignore b/.gitignore
@@ -1221,6 +1222,7 @@ 

  Subject: A commit on branch feature

  

  

+ More information

  ---

  

  diff --git a/sources b/sources
@@ -2021,6 +2023,17 @@ 

              self.assertIn(

                  '<input type="submit" class="btn btn-primary" value="Create Pull Request">\n',

                  output_text)

+             # Check that we prefilled the input fields as expected:

+             self.assertIn(

+                 '<input class="form-control" id="title" name="title" '

+                 'placeholder="Pull Request Title" required="required" '

+                 'type="text" value="A commit on branch feature">',

+                 output_text)

+             self.assertIn(

+                 '''<textarea class="form-control" rows=8 id="initial_comment" name="initial_comment"

+             placeholder="Describe your changes" tabindex=1>

+ More information</textarea>

+             <div id="preview" class="p-1">''', output_text)

  

              csrf_token = self.get_csrf(output=output)

  

Pretty sure this works... PLease double check to see if this fixes the issue.

Fixes #3674

Code looks fine to me. Could we add a test for this? (somehow I'm surprised we don't have one already)

rebased onto fb82756

2 years ago

1 new commit added

  • Add a test ensuring the input fields are pre-populated when the PR has only one commit
2 years ago

Pending results from Jenkins, the test looks good too!

2 new commits added

  • Add a test ensuring the input fields are pre-populated when the PR has only one commit
  • fix regression where PR comment was not filled in anymore
2 years ago

Pull-Request has been merged by pingou

2 years ago