Remove leading and trailing blank lines in review comments.

Review Request #4561 — Created Sept. 12, 2013 and submitted

Information

Review Board
master

Reviewers

Remove leading and trailing blank lines in review comments.

When a user submits a review comment, leading and trailing
blank lines are saved as part of the comment. We want to strip
these blank lines before saving the comment to the database.

Reviewed at https://reviews.reviewboard.org/r/4561/
Fix for issue 2933

Created new review request and manually tested:

-review
-review reply
-diff comment
-reply diff comment
-file attachment comment
-reply file attachment comment

Unit tests pass.

Description From Last Updated

Col: 80 E501 line too long (84 > 79 characters)

reviewbotreviewbot

There should be a blank line separating the if block from the setattr.

chipx86chipx86
reviewbot
  1. This is a review from Review Bot.
    Tool: PEP8 Style Checker
    Processed Files:
    reviewboard/reviews/templatetags/reviewtags.py
    Ignored Files:

  2. 
      
reviewbot
  1. This is a review from Review Bot.
    Tool: Pyflakes
    Processed Files:
    reviewboard/reviews/templatetags/reviewtags.py
    Ignored Files:

  2. 
      
ED
SM
  1. Great to see the first UCOSP review request for the term, congratulations!

    I feel like this would be better handled by actually stripping the whitespace
    before the comment is saved to the database. That way we don't have this extra
    whitespace hanging around, especially since the comment will be rendered in
    multiple places, such as when review board sends out notification emails.

    Also, you should fill out the "Testing Done" section on your review requests
    to tell us what you tested, and how you tested it.

    Really happy to see you getting started! :D

  2. 
      
ED
reviewbot
  1. This is a review from Review Bot.
    Tool: PEP8 Style Checker
    Processed Files:
    Ignored Files:
    reviewboard/static/rb/js/views/reviewReplyEditorView.js

  2. 
      
reviewbot
  1. This is a review from Review Bot.
    Tool: Pyflakes
    Processed Files:
    Ignored Files:
    reviewboard/static/rb/js/views/reviewReplyEditorView.js

  2. 
      
david
  1. This looks like it will work for replies to reviews, but not for the initial comments on any given line. We probably want a similar change in commentDialogView.js

    1. Is this something we want to take care of at the JS level, or would it be better to strip this stuff in the Web API or Model? I feel like we also want stripping to happen when comments are posted from some client other than the official Review Board web frontend.

    2. I think I agree with this--we should probably change the implementation (or add to it) to do this from python.

  2. 
      
ED
ED
reviewbot
  1. This is a review from Review Bot.
    Tool: PEP8 Style Checker
    Processed Files:
    reviewboard/webapi/resources/review_reply_file_attachment_comment.py
    reviewboard/webapi/resources/review_file_attachment_comment.py
    reviewboard/webapi/resources/review_screenshot_comment.py
    reviewboard/webapi/resources/base_review.py
    reviewboard/webapi/resources/review_reply_diff_comment.py
    reviewboard/webapi/resources/review_reply_screenshot_comment.py
    reviewboard/webapi/resources/review_diff_comment.py
    reviewboard/webapi/resources/review_reply.py
    Ignored Files:

  2. Col: 80
    E501 line too long (84 > 79 characters)

  3. 
      
reviewbot
  1. This is a review from Review Bot.
    Tool: Pyflakes
    Processed Files:
    reviewboard/webapi/resources/review_reply_file_attachment_comment.py
    reviewboard/webapi/resources/review_file_attachment_comment.py
    reviewboard/webapi/resources/review_screenshot_comment.py
    reviewboard/webapi/resources/base_review.py
    reviewboard/webapi/resources/review_reply_diff_comment.py
    reviewboard/webapi/resources/review_reply_screenshot_comment.py
    reviewboard/webapi/resources/review_diff_comment.py
    reviewboard/webapi/resources/review_reply.py
    Ignored Files:

  2. 
      
ED
reviewbot
  1. This is a review from Review Bot.
    Tool: PEP8 Style Checker
    Processed Files:
    reviewboard/webapi/resources/review_reply_file_attachment_comment.py
    reviewboard/webapi/resources/review_file_attachment_comment.py
    reviewboard/webapi/resources/review_screenshot_comment.py
    reviewboard/webapi/resources/base_review.py
    reviewboard/webapi/resources/review_reply_diff_comment.py
    reviewboard/webapi/resources/review_reply_screenshot_comment.py
    reviewboard/webapi/resources/review_diff_comment.py
    reviewboard/webapi/resources/review_reply.py
    Ignored Files:

  2. 
      
reviewbot
  1. This is a review from Review Bot.
    Tool: Pyflakes
    Processed Files:
    reviewboard/webapi/resources/review_reply_file_attachment_comment.py
    reviewboard/webapi/resources/review_file_attachment_comment.py
    reviewboard/webapi/resources/review_screenshot_comment.py
    reviewboard/webapi/resources/base_review.py
    reviewboard/webapi/resources/review_reply_diff_comment.py
    reviewboard/webapi/resources/review_reply_screenshot_comment.py
    reviewboard/webapi/resources/review_diff_comment.py
    reviewboard/webapi/resources/review_reply.py
    Ignored Files:

  2. 
      
ED
chipx86
  1. 
      
  2. reviewboard/webapi/resources/base_review.py (Diff revision 5)
     
     
     
     

    There should be a blank line separating the if block from the setattr.

  3. 
      
ED
reviewbot
  1. This is a review from Review Bot.
    Tool: PEP8 Style Checker
    Processed Files:
    reviewboard/webapi/resources/review_reply_file_attachment_comment.py
    reviewboard/webapi/resources/review_file_attachment_comment.py
    reviewboard/webapi/resources/review_screenshot_comment.py
    reviewboard/webapi/resources/base_review.py
    reviewboard/webapi/resources/review_reply_diff_comment.py
    reviewboard/webapi/resources/review_reply_screenshot_comment.py
    reviewboard/webapi/resources/review_diff_comment.py
    reviewboard/webapi/resources/review_reply.py
    Ignored Files:

  2. 
      
reviewbot
  1. This is a review from Review Bot.
    Tool: Pyflakes
    Processed Files:
    reviewboard/webapi/resources/review_reply_file_attachment_comment.py
    reviewboard/webapi/resources/review_file_attachment_comment.py
    reviewboard/webapi/resources/review_screenshot_comment.py
    reviewboard/webapi/resources/base_review.py
    reviewboard/webapi/resources/review_reply_diff_comment.py
    reviewboard/webapi/resources/review_reply_screenshot_comment.py
    reviewboard/webapi/resources/review_diff_comment.py
    reviewboard/webapi/resources/review_reply.py
    Ignored Files:

  2. 
      
david
  1. Ship It!

  2. 
      
ED
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to master (63327ca). Thanks!

Loading...