Move common comment code into BaseComment.

Review Request #3149 — Created June 17, 2012 and submitted

Information

Review Board

Reviewers

Move common comment code into BaseComment.

BaseComment is a nice base class, but wasn't doing enough. In order to
simplify maintenance, the reply_to, timestamp, text, and objects
variables and the public_replies, get_review_url, and __unicode__
functions have been moved into BaseComment.

This also introduces a get_review_request function, which is used
instead of calling self.review.get().review_request. If the
_review_request variable is assigned on the comment, it will be returned
instead, which skips a couple of otherwise necessary queries.
Unit tests pass. The review request page still works correctly.
ME
  1. I was actually meaning to move these methods into BaseComment now that these methods are a bit more modular. Thanks Christian.
  2. reviewboard/reviews/models.py (Diff revision 1)
     
     
    This prefix bugs me, I was thinking it should be "dcomment" or something more informative than just "comment".
    1. Isn't that what you had in the other change?
    2. It is. I used "comment" as it was the naming convention already used in the older "get_review_url()".
      
      I'm just thinking it would be more descriptive to use "dcomment" for both branches.
    3. Problem is, we'd then break every link out there.
  3. reviewboard/reviews/models.py (Diff revision 1)
     
     
     
     
     
     
    I might be losing my mind here, but I thought I removed this function earlier and replaced it with the built-in Django filter.
    1. That was all on master. This is going on 1.6.x.
    2. That makes sense.
  4. 
      
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed