Adding the reviews a user has made to their profile

Review Request #5484 — Created Feb. 16, 2014 and submitted

Information

Review Board
master
3e0b97a...

Reviewers

I have added the reviews a user has made to their profile page, which can be accessed at /users/<username>/reviews/
The columns shown include: * summary (of review request) * submitter of review request * date reviewed

Created unit tests to test that the reviews page works, and reviews on private review requests are not shown.


Description From Last Updated

Since this is just a mixin now, it should be named "UserPageDataGridMixin".

chipx86chipx86

The suffix for this class is "Grid," but should be "DataGrid" to match the others.

chipx86chipx86

Trailing whitespace.

chipx86chipx86

Too many blank lines.

chipx86chipx86

Some older views are inconsistent in this way, but docstrings must follow the following format: """One-line summary.""" or: """One-line summary. …

chipx86chipx86

Please wrap this to 80 columns.

daviddavid

This should use _() for localization.

daviddavid

Please wrap at 80 columns.

daviddavid

This should use _() for localization.

daviddavid

Docstrings should start with a single line for a summary, then (optionally) a blank line and paragraphs of description. Please …

daviddavid

Your code here uses 2-space indentation instead of 4.

daviddavid

I don't know how permanent this is, but it should probably be formatted more like this: datagrid.tabs = [ (UserPageReviewRequestDataGrid.tab_title(username), …

daviddavid

Please wrap to 80 columns.

daviddavid

Please put a space ofter the :. Here and throughout this file.

daviddavid

Remove this line.

daviddavid

Remove this line.

daviddavid

Indent 2 spaces in LESS files.

daviddavid

Indent 1 space in HTML. Also note that we add spaces between {% and the tag names for block tags …

daviddavid

If this isn't necessary, can you remove it?

daviddavid

If this isn't necessary, can you remove it?

daviddavid

There's an extra space between 'review_summary' and ,

daviddavid

Please capitalize the "Do"

daviddavid

Maybe mention that this is an abstract class?

daviddavid

Wrap to 80 columns.

daviddavid

This doesn't match between here and UserPageReviewRequestDataGrid (one has "user page", one has "user's page"). Can you also include a …

daviddavid

Trailing whitespace. Can you also rewrap this to put one item per line?

daviddavid

Indent 1 more space.

daviddavid

Indent 1 more space.

daviddavid

Indent 1 more space.

daviddavid

Indent 1 more space.

daviddavid

Indent 1 more space.

daviddavid

Remove these two lines.

daviddavid

Can you switch the order of these two URLs?

daviddavid

Comments should have a space between # and the comment text, and start with a capital letter.

daviddavid

Maybe put these all on the same line?

daviddavid

Maybe put these all on the same line? Also, watch out for trailing whitespace.

daviddavid

Comments should have a space between # and the comment text, and start with a capital letter.

daviddavid

Indent 1 more space.

daviddavid

Indent 1 more space.

daviddavid

Indent 1 more space.

daviddavid

Hmm. It looks like it's been quite some time since you pulled from the origin repository. We've made some changes …

daviddavid

Indent 2 more spaces.

daviddavid

Can you add a blank line here?

daviddavid

"Group" hasn't been imported here. You should import it at the top of this method (like in ReviewRequestManager._query)

daviddavid

These are pretty generic class names, and the !important makes me scared. Can you maybe make these a bit more …

daviddavid

Missing trailing period.

chipx86chipx86

This can be one line, like the one above.

chipx86chipx86

This is all a copy/paste of the load_extra_data in ReviewRequestDataGrid. We should pull that out into a ShowClosedReviewRequestsMixin.

chipx86chipx86

Should remove the blank line.

chipx86chipx86

Wrong class.

chipx86chipx86

Space before %

chipx86chipx86

Should remove the blank line.

chipx86chipx86

Space before %

chipx86chipx86

The latter part of that regex is too verbose. We know it'll just be [a-z-]

chipx86chipx86

Should be on one line.

chipx86chipx86

No blank line.

chipx86chipx86

No need for this comment.

chipx86chipx86

Let's do review-requests instead. Also, is None

chipx86chipx86

This should be: datagrid_cls = UserPageReviewRequestDataGrid Then below, you can just do: datagrid = datagrid_cls(request, .....)

chipx86chipx86

The parameters are the same for both classes. Let's compute the class here, and initialize it after the conditionals.

chipx86chipx86

No need for this comment.

chipx86chipx86

Blank line between these.

chipx86chipx86

Missing period.

chipx86chipx86

There's a bunch of !important rules in here. We should remove all of them, and instead nest the rules better …

chipx86chipx86

Should just list the class, not the element. Same with all the ones below.

chipx86chipx86

The &. ones go above the child element/class rules.

chipx86chipx86

THis should go above the .datagrid-title rule above.

chipx86chipx86

Too many spaces before endif.

chipx86chipx86

Shouldn't have &nbsp;. If we're trying to add some spacing, that should be done with CSS.

chipx86chipx86

It's not valid to have a <ul> inside another <ul>. It needs to be in <li>.

chipx86chipx86

Indentation got a bit wacky here.

daviddavid

Col: 17 E126 continuation line over-indented for hanging indent

reviewbotreviewbot

Col: 5 E303 too many blank lines (2)

reviewbotreviewbot

local variable 'review1' is assigned to but never used

reviewbotreviewbot

local variable 'review2' is assigned to but never used

reviewbotreviewbot

'SignalHook' imported but unused

reviewbotreviewbot

'TemplateHook' imported but unused

reviewbotreviewbot

'URLHook' imported but unused

reviewbotreviewbot

Col: 21 E128 continuation line under-indented for visual indent

reviewbotreviewbot

Col: 38 E127 continuation line over-indented for visual indent

reviewbotreviewbot

Col: 38 E127 continuation line over-indented for visual indent

reviewbotreviewbot

'SignalHook' imported but unused

reviewbotreviewbot

'TemplateHook' imported but unused

reviewbotreviewbot

'URLHook' imported but unused

reviewbotreviewbot

Col: 21 E128 continuation line under-indented for visual indent

reviewbotreviewbot

Needs a trailing period.

chipx86chipx86

For each of these, you should have a trailing comma after the value in the dictionary, and the }) should …

chipx86chipx86

These can probably just be constants on the class, right?

chipx86chipx86

I don't think this is needed.

chipx86chipx86

This code is pretty similar to what's in ReviewRequestManager. I don't expect you to worry about refactoring all this right …

chipx86chipx86
chipx86
  1. 
      
  2. reviewboard/datagrids/grids.py (Diff revision 1)
     
     

    Since this is just a mixin now, it should be named "UserPageDataGridMixin".

  3. reviewboard/datagrids/grids.py (Diff revision 1)
     
     

    The suffix for this class is "Grid," but should be "DataGrid" to match the others.

  4. reviewboard/datagrids/grids.py (Diff revision 1)
     
     

    Trailing whitespace.

  5. reviewboard/datagrids/grids.py (Diff revision 1)
     
     
     
     
     

    Too many blank lines.

  6. reviewboard/datagrids/views.py (Diff revision 1)
     
     
     
     

    Some older views are inconsistent in this way, but docstrings must follow the following format:

    """One-line summary."""
    

    or:

    """One-line summary.
    
    Multi-line description.
    """
    
  7. 
      
TA
TA
david
  1. Reading through this code, it looks like most of the functionality is here. Can you specify in the description what is left to do, and if it's pretty close, remove the WIP tag?

  2. 
      
TA
TA
TA
TA
david
  1. 
      
  2. reviewboard/datagrids/grids.py (Diff revision 5)
     
     

    Please wrap this to 80 columns.

  3. reviewboard/datagrids/grids.py (Diff revision 5)
     
     

    This should use _() for localization.

  4. reviewboard/datagrids/grids.py (Diff revision 5)
     
     
     

    Please wrap at 80 columns.

  5. reviewboard/datagrids/grids.py (Diff revision 5)
     
     

    This should use _() for localization.

  6. reviewboard/datagrids/views.py (Diff revision 5)
     
     
     
     

    Docstrings should start with a single line for a summary, then (optionally) a blank line and paragraphs of description. Please also wrap to 80 columns.

  7. reviewboard/datagrids/views.py (Diff revision 5)
     
     
     
     
     
     
     

    Your code here uses 2-space indentation instead of 4.

  8. reviewboard/datagrids/views.py (Diff revision 5)
     
     
     
     

    I don't know how permanent this is, but it should probably be formatted more like this:

    datagrid.tabs = [
        (UserPageReviewRequestDataGrid.tab_title(username),
         reverse('user', args=[username])),
        (UserPageReviewsDataGrid.tab_title(username),
         reverse('user', args=[username, 'reviews'])),
    ]
    
    1. should this be taken out into a helper function, or done in another way?

    2. I think it's fine here.

  9. reviewboard/extensions/hooks.py (Diff revision 5)
     
     

    Please wrap to 80 columns.

  10. reviewboard/static/rb/css/common.less (Diff revision 5)
     
     

    Please put a space ofter the :. Here and throughout this file.

  11. reviewboard/static/rb/css/common.less (Diff revision 5)
     
     

    Remove this line.

  12. reviewboard/static/rb/css/common.less (Diff revision 5)
     
     

    Remove this line.

  13. reviewboard/static/rb/css/common.less (Diff revision 5)
     
     
     
     

    Indent 2 spaces in LESS files.

  14. reviewboard/templates/datagrids/review_request_listview.html (Diff revision 5)
     
     
     
     
     
     
     
     

    Indent 1 space in HTML. Also note that we add spaces between {% and the tag names for block tags (separate from the HTML indentation). This file hasn't been updated to indent the tags correctly -- would you mind doing so while you're changing this? See reviewboard/templates/reviews/review_request_box.html for a good example.

  15. 
      
TA
TA
TA
TA
david
  1. This is looking pretty good! I have a bunch of style comments.

  2. reviewboard/datagrids/grids.py (Diff revision 9)
     
     

    If this isn't necessary, can you remove it?

  3. reviewboard/datagrids/grids.py (Diff revision 9)
     
     

    If this isn't necessary, can you remove it?

  4. reviewboard/datagrids/grids.py (Diff revision 9)
     
     

    There's an extra space between 'review_summary' and ,

  5. reviewboard/datagrids/grids.py (Diff revision 9)
     
     

    Please capitalize the "Do"

  6. reviewboard/datagrids/grids.py (Diff revision 9)
     
     

    Maybe mention that this is an abstract class?

  7. reviewboard/datagrids/grids.py (Diff revision 9)
     
     

    Wrap to 80 columns.

  8. reviewboard/datagrids/grids.py (Diff revision 9)
     
     

    This doesn't match between here and UserPageReviewRequestDataGrid (one has "user page", one has "user's page"). Can you also include a mention of reviews vs. review requests in the docstring summary?

  9. reviewboard/datagrids/tests.py (Diff revision 9)
     
     

    Trailing whitespace. Can you also rewrap this to put one item per line?

  10. reviewboard/datagrids/tests.py (Diff revision 9)
     
     
     

    Indent 1 more space.

  11. reviewboard/datagrids/tests.py (Diff revision 9)
     
     
     

    Indent 1 more space.

  12. reviewboard/datagrids/tests.py (Diff revision 9)
     
     

    Indent 1 more space.

  13. reviewboard/datagrids/tests.py (Diff revision 9)
     
     

    Indent 1 more space.

  14. reviewboard/datagrids/tests.py (Diff revision 9)
     
     

    Indent 1 more space.

  15. reviewboard/datagrids/tests.py (Diff revision 9)
     
     
     

    Remove these two lines.

  16. reviewboard/datagrids/urls.py (Diff revision 9)
     
     
     
     
     

    Can you switch the order of these two URLs?

  17. reviewboard/datagrids/views.py (Diff revision 9)
     
     

    Comments should have a space between # and the comment text, and start with a capital letter.

  18. reviewboard/datagrids/views.py (Diff revision 9)
     
     
     
     

    Maybe put these all on the same line?

    1. Putting them on one line makes them exceed 80 columns - should I just move the first variable (request) to the same line as the function call, and keep the other variables as is?

    2. In that case, I'd just leave it as-is and drop this issue.

  19. reviewboard/datagrids/views.py (Diff revision 9)
     
     
     
     

    Maybe put these all on the same line? Also, watch out for trailing whitespace.

  20. reviewboard/datagrids/views.py (Diff revision 9)
     
     

    Comments should have a space between # and the comment text, and start with a capital letter.

  21. reviewboard/datagrids/views.py (Diff revision 9)
     
     

    Indent 1 more space.

  22. reviewboard/datagrids/views.py (Diff revision 9)
     
     

    Indent 1 more space.

  23. reviewboard/extensions/hooks.py (Diff revision 9)
     
     

    Indent 1 more space.

  24. 
      
TA
TA
david
  1. 
      
  2. reviewboard/reviews/managers.py (Diff revision 11)
     
     
     
     
     
     

    Hmm. It looks like it's been quite some time since you pulled from the origin repository. We've made some changes to the ReviewRequest version of this query to improve performance. Can you rebase on top of the latest master code, and add the accessible_repo_ids and accessible_group_ids mechanism that ReviewRequestManager._query uses?

  3. 
      
TA
david
  1. Almost there!

  2. reviewboard/datagrids/views.py (Diff revision 12)
     
     

    Indent 2 more spaces.

  3. reviewboard/reviews/managers.py (Diff revision 12)
     
     
     

    Can you add a blank line here?

  4. reviewboard/reviews/managers.py (Diff revision 12)
     
     

    "Group" hasn't been imported here. You should import it at the top of this method (like in ReviewRequestManager._query)

  5. reviewboard/static/rb/css/common.less (Diff revision 12)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

    These are pretty generic class names, and the !important makes me scared. Can you maybe make these a bit more specific, so that these rules won't bleed out into other parts of the UI?

    1. I modified the rules to be more specific and encapsulated, though I still use !important in some places to override the datagrids css rules. is this ok?

    2. This looks great.

  6. 
      
TA
david
  1. This looks good to me. Because it's a big change, Christian is also going to take a look before we push it. Nice work!

  2. 
      
chipx86
  1. 
      
  2. reviewboard/datagrids/columns.py (Diff revision 13)
     
     

    Missing trailing period.

  3. reviewboard/datagrids/columns.py (Diff revision 13)
     
     
     

    This can be one line, like the one above.

  4. reviewboard/datagrids/grids.py (Diff revision 13)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

    This is all a copy/paste of the load_extra_data in ReviewRequestDataGrid. We should pull that out into a ShowClosedReviewRequestsMixin.

    1. is there a way to programmatically decide what is being filtered in the queryset (lines 213, 216)? ReviewRequestDataGrid filters on just status, instead of the review_request

    2. Ah, good point.

      What I'd do then is to have the mixin require an attribute on the class that defines what to filter by. Something like status_query_field, which can be set to status or review_request__status. You can then use this with:

      self.queryset = self.queryset.filter(**{
          self.status_query_field: 'P',
      })
      
  5. reviewboard/datagrids/grids.py (Diff revision 13)
     
     
     
     

    Should remove the blank line.

  6. reviewboard/datagrids/grids.py (Diff revision 13)
     
     

    Wrong class.

  7. reviewboard/datagrids/grids.py (Diff revision 13)
     
     

    Space before %

  8. reviewboard/datagrids/grids.py (Diff revision 13)
     
     
     
     

    Should remove the blank line.

  9. reviewboard/datagrids/grids.py (Diff revision 13)
     
     

    Space before %

  10. reviewboard/datagrids/urls.py (Diff revision 13)
     
     

    The latter part of that regex is too verbose. We know it'll just be [a-z-]

  11. reviewboard/datagrids/views.py (Diff revision 13)
     
     
     

    Should be on one line.

    1. this comment has more content after this line about the grid parameter, should i remove that content?

    2. You can probably simplify it to: "A user's profile page, showing their review requests and reviews."

    3. Christian just means put these two together and leave the rest as-is:

      """A user's profile page...

      That way the docstring doesn't start with a blank line.

  12. reviewboard/datagrids/views.py (Diff revision 13)
     
     
     
     

    No blank line.

  13. reviewboard/datagrids/views.py (Diff revision 13)
     
     

    No need for this comment.

  14. reviewboard/datagrids/views.py (Diff revision 13)
     
     

    Let's do review-requests instead.

    Also, is None

  15. reviewboard/datagrids/views.py (Diff revision 13)
     
     
     
     
     
     
     
     
     
     

    The parameters are the same for both classes. Let's compute the class here, and initialize it after the conditionals.

  16. reviewboard/datagrids/views.py (Diff revision 13)
     
     

    No need for this comment.

  17. reviewboard/datagrids/views.py (Diff revision 13)
     
     
     

    Blank line between these.

  18. reviewboard/reviews/managers.py (Diff revision 13)
     
     

    Missing period.

  19. reviewboard/static/rb/css/common.less (Diff revision 13)
     
     
     
     
     

    There's a bunch of !important rules in here. We should remove all of them, and instead nest the rules better so that the browser will naturally choose them.

  20. reviewboard/static/rb/css/common.less (Diff revision 13)
     
     

    Should just list the class, not the element.

    Same with all the ones below.

  21. reviewboard/static/rb/css/common.less (Diff revision 13)
     
     

    The &. ones go above the child element/class rules.

  22. reviewboard/static/rb/css/common.less (Diff revision 13)
     
     

    THis should go above the .datagrid-title rule above.

  23. Too many spaces before endif.

  24. Shouldn't have &nbsp;. If we're trying to add some spacing, that should be done with CSS.

  25. It's not valid to have a <ul> inside another <ul>. It needs to be in <li>.

  26. 
      
TA
chipx86
  1. Looking good!

  2. reviewboard/datagrids/views.py (Diff revisions 13 - 14)
     
     

    This should be:

    datagrid_cls = UserPageReviewRequestDataGrid
    

    Then below, you can just do:

    datagrid = datagrid_cls(request, .....)
    
  3. 
      
TA
TA
david
  1. 
      
  2. reviewboard/datagrids/grids.py (Diff revision 16)
     
     
     
     
     
     
     
     
     

    Indentation got a bit wacky here.

  3. 
      
TA
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        reviewboard/datagrids/views.py
        reviewboard/datagrids/columns.py
        reviewboard/datagrids/tests.py
        reviewboard/datagrids/urls.py
        reviewboard/extensions/hooks.py
        reviewboard/datagrids/grids.py
        reviewboard/reviews/managers.py
      Ignored Files:
        reviewboard/static/rb/css/common.less
        reviewboard/templates/datagrids/review_request_listview.html
    
    
  2. reviewboard/datagrids/grids.py (Diff revision 17)
     
     
    Col: 17
     E126 continuation line over-indented for hanging indent
    
  3. reviewboard/datagrids/grids.py (Diff revision 17)
     
     
    Col: 5
     E303 too many blank lines (2)
    
  4. reviewboard/reviews/managers.py (Diff revision 17)
     
     
    Col: 21
     E128 continuation line under-indented for visual indent
    
    1. hm i think adding an indent here causes the line to go over 80 columns - should i indent it anyway?
      Also the indent here is the same indent used in other lines in this function

  5. 
      
reviewbot
  1. This is a review from Review Bot.
      Tool: Pyflakes
      Processed Files:
        reviewboard/datagrids/views.py
        reviewboard/datagrids/columns.py
        reviewboard/datagrids/tests.py
        reviewboard/datagrids/urls.py
        reviewboard/extensions/hooks.py
        reviewboard/datagrids/grids.py
        reviewboard/reviews/managers.py
      Ignored Files:
        reviewboard/static/rb/css/common.less
        reviewboard/templates/datagrids/review_request_listview.html
    
    
  2. reviewboard/datagrids/tests.py (Diff revision 17)
     
     
     local variable 'review1' is assigned to but never used
    
  3. reviewboard/datagrids/tests.py (Diff revision 17)
     
     
     local variable 'review2' is assigned to but never used
    
  4. reviewboard/extensions/hooks.py (Diff revision 17)
     
     
     'SignalHook' imported but unused
    
  5. reviewboard/extensions/hooks.py (Diff revision 17)
     
     
     'TemplateHook' imported but unused
    
  6. reviewboard/extensions/hooks.py (Diff revision 17)
     
     
     'URLHook' imported but unused
    
  7. 
      
TA
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        reviewboard/datagrids/views.py
        reviewboard/datagrids/columns.py
        reviewboard/datagrids/tests.py
        reviewboard/datagrids/urls.py
        reviewboard/extensions/hooks.py
        reviewboard/datagrids/grids.py
        reviewboard/reviews/managers.py
      Ignored Files:
        reviewboard/static/rb/css/common.less
        reviewboard/templates/datagrids/review_request_listview.html
    
    
  2. reviewboard/datagrids/tests.py (Diff revision 18)
     
     
    Col: 38
     E127 continuation line over-indented for visual indent
    
  3. reviewboard/datagrids/tests.py (Diff revision 18)
     
     
    Col: 38
     E127 continuation line over-indented for visual indent
    
  4. reviewboard/reviews/managers.py (Diff revision 18)
     
     
    Col: 21
     E128 continuation line under-indented for visual indent
    
    1. added a backslash instead - is this fine?

    2. I know we haven't really been using this form elsewhere, but you can just use the |= operator:

      group_query |= Q(review_request__target_groups__in=...)
      
  5. 
      
reviewbot
  1. This is a review from Review Bot.
      Tool: Pyflakes
      Processed Files:
        reviewboard/datagrids/views.py
        reviewboard/datagrids/columns.py
        reviewboard/datagrids/tests.py
        reviewboard/datagrids/urls.py
        reviewboard/extensions/hooks.py
        reviewboard/datagrids/grids.py
        reviewboard/reviews/managers.py
      Ignored Files:
        reviewboard/static/rb/css/common.less
        reviewboard/templates/datagrids/review_request_listview.html
    
    
  2. reviewboard/extensions/hooks.py (Diff revision 18)
     
     
     'SignalHook' imported but unused
    
  3. reviewboard/extensions/hooks.py (Diff revision 18)
     
     
     'TemplateHook' imported but unused
    
  4. reviewboard/extensions/hooks.py (Diff revision 18)
     
     
     'URLHook' imported but unused
    
  5. 
      
TA
chipx86
  1. A few small things. This is pretty great! Just a couple trivial style changes, and we'll be able to put this in for 2.1 :)

  2. reviewboard/datagrids/grids.py (Diff revision 19)
     
     

    Needs a trailing period.

  3. reviewboard/datagrids/grids.py (Diff revision 19)
     
     
     
     
     
     

    For each of these, you should have a trailing comma after the value in the dictionary, and the }) should be aligned with the opening statement on its own line, like:

    self.queryset = self.queryset.filter(**{
        ...
    });
    
  4. reviewboard/datagrids/grids.py (Diff revision 19)
     
     
     

    These can probably just be constants on the class, right?

  5. reviewboard/datagrids/grids.py (Diff revision 19)
     
     
     

    I don't think this is needed.

  6. reviewboard/reviews/managers.py (Diff revision 19)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

    This code is pretty similar to what's in ReviewRequestManager. I don't expect you to worry about refactoring all this right now, but we should probably do this at some point.

    Can you put a TODO comment above all this code saying it should be consolidated with the queries in ReviewRequestManager?

  7. 
      
TA
TA
TA
chipx86
  1. Ship It!

  2. 
      
TA
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to master (f33e964)
Loading...