Add a "Last Updated By" column to ReviewBoard dashboard

Review Request #11524 — Created March 14, 2021 and updated

Information

Review Board
master

Reviewers

Currently, the last updated column only shows the timestamp
of last activity that has occurred. It is desireable to show
the user who is responsible for the last activity as well.
Therefore, we need to add another column "Last Updated By" to
the dashboard.

Manual testing:
1. On the UI, activate the new Last Updated By column by selecting it.
2. It should show the user (linkable to the user's profile) that is
responsible for the last update.
Tested on Safari, Chrome, and Firefox.

Automated unit testing:
1. Run ./tests/runtests.py reviewboard.datagrids.tests.

Summary ID
Add class LastUpdatedByColumn and override get_user method
255db9e04b1a4928e07e6a3ead76f8c82335f85b
Fixed import module
b205836025ceaa6c0edbb9b2ed8cab2c7543968f
Implemented get_user based on the last activity and added the column to the grid view
68529a8640bbaa2834f8a1a14d8d71104a6ca934
Fixed formatting
8d6e529f89548a65a743e88b31ef35457204bf81
Fixed rendering column for last_updated_by
d8b52f1fbfa369a6d746aac5602f1f5b86d67175
Fixed get_user
c9db8baabca7b96a0104deba3f039798225d2335
Added unit tests for Last Updated By column
0266cd3020c961dda57562506c34a0eb21017086
Fixed line too long error
1b6a908d77f50b5187a88cbf4ed9bfd95d73315e
Removed unused fields in datagrids/tests.py
4e8b1bee638b480283a3e914d9db44a967809691
Fixes based on mentor's reviews
bf1ba709d8cf9b4592948efccdac617ae7bc2958
Fixed trailing whitespace
445fe015a763bd92edce046b460b2c6ed7623b31
Description From Last Updated

I'm a bit confused what the difference is between Review, Review Request and Review Request Draft. Would you mind clarifying …

mderosemderose

E501 line too long (88 > 79 characters)

reviewbotreviewbot

W293 blank line contains whitespace

reviewbotreviewbot

E501 line too long (80 > 79 characters)

reviewbotreviewbot

F841 local variable 'review' is assigned to but never used

reviewbotreviewbot

W293 blank line contains whitespace

reviewbotreviewbot

E501 line too long (81 > 79 characters)

reviewbotreviewbot

F841 local variable 'diffset' is assigned to but never used

reviewbotreviewbot

F841 local variable 'review' is assigned to but never used

reviewbotreviewbot

F841 local variable 'diffset' is assigned to but never used

reviewbotreviewbot

Docstrings need to conform to our documentation guidelines. Look for other functions like get_user and make sure you're following that …

chipx86chipx86

All variables in our Python code use snake_case pattern, rather than camelCase.

chipx86chipx86

This is being set and then overridden below. Doesn't seem like this needs to be set here, because of that.

chipx86chipx86

Something important to note here is that we can't necessarily assume that the review request's owner is the user that …

chipx86chipx86

This can cause problems down the road if we introduce more types of objects and one of them isn't owner. …

chipx86chipx86

Imports should always be in alphabetical order.

chipx86chipx86

The last parameter of a function call shouldn't have a trailing comma. The ) should be on the same line …

chipx86chipx86

This doesn't seem to be related to your change, so it should be reverted.

chipx86chipx86

This will also need to be in alphabetical order.

chipx86chipx86

This from .. import .. also needs to be in alphabetical order within the list of all imports.

chipx86chipx86

This is only used if the column is testing with a LocalSite. None of these are, from what I can …

chipx86chipx86

The trailing """ must be on its own line when it's a multi-line docstring. Also, this docstring doesn't say what …

chipx86chipx86

Several of our test objects use the same usernames, which can create false-positives in username-based tests. Your code should explicitly …

chipx86chipx86

We're not testing get_last_activity_info(). This could would be better served testing get_user() on the column.

chipx86chipx86

For each of these, these usernames very well may be the correct ones, but there's nothing currently indicating that we …

chipx86chipx86

These are probably wrapping prematurely. Same with the other unit tests.

chipx86chipx86

W291 trailing whitespace

reviewbotreviewbot

W291 trailing whitespace

reviewbotreviewbot

F401 'reviewboard.diffviewer.models.DiffSet' imported but unused

reviewbotreviewbot

W291 trailing whitespace

reviewbotreviewbot

W291 trailing whitespace

reviewbotreviewbot

W291 trailing whitespace

reviewbotreviewbot
CL
mderose
  1. I think this makes sense. I just was hoping you could provide a quick clarification just for my understanding. Good work on this!

  2. reviewboard/datagrids/columns.py (Diff revision 2)
     
     
    Show all issues

    I'm a bit confused what the difference is between Review, Review Request and Review Request Draft. Would you mind clarifying this please?

    1. Hi Matthew! Based on my understanding, a review request is the component (e.g your code changes) that you hand over to be reviewed. While a review is a thread of reviews or discussions inside a review request. And lastly, the review request draft is the review request that you have not published yet (where you can decide on publishing or discarding).

  3. 
      
CL
Review request changed
Summary:
[WIP] Add a "Last Updated By" column to ReviewBoard dashboard
Add a "Last Updated By" column to ReviewBoard dashboard
Testing Done:
~  
  1. On the UI, activate the new Last Updated By column by selecting it.
~  
  1. It should show the user (linkable to the user's profile) that is
    responsible for the last update.
  ~

Manual testing:

  ~ 1. On the UI, activate the new Last Updated By column by selecting it.
  + 2. It should show the user (linkable to the user's profile) that is
  + responsible for the last update.

  +
  +

Automated unit testing:

  + 1. Run ./tests/runtests.py reviewboard.datagrids.tests 115 118 119.

Commits:
Summary ID
Add class LastUpdatedByColumn and override get_user method
e60cd70e746869ff2df39e3a61702b515cf203c2
Fixed import module
261c36450af4b30741d28e082be47c4c15ca0a98
Implemented get_user based on the last activity and added the column to the grid view
04668ba55ef7e0adf33dbcaaa8bfdc1c01ed2b13
Fixed formatting
623e6b8ce884bfa10a5377e515f59f867bc07829
Fixed rendering column for last_updated_by
5b1b960f398a77975c526d35356b6737b30282fd
Fixed get_user
79ea1a797f559c2e4cf501709ca9c884f56c8522
Add class LastUpdatedByColumn and override get_user method
255db9e04b1a4928e07e6a3ead76f8c82335f85b
Fixed import module
b205836025ceaa6c0edbb9b2ed8cab2c7543968f
Implemented get_user based on the last activity and added the column to the grid view
68529a8640bbaa2834f8a1a14d8d71104a6ca934
Fixed formatting
8d6e529f89548a65a743e88b31ef35457204bf81
Fixed rendering column for last_updated_by
d8b52f1fbfa369a6d746aac5602f1f5b86d67175
Fixed get_user
c9db8baabca7b96a0104deba3f039798225d2335
Added unit tests for Last Updated By column
0266cd3020c961dda57562506c34a0eb21017086

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

CL
Review request changed
Commits:
Summary ID
Add class LastUpdatedByColumn and override get_user method
255db9e04b1a4928e07e6a3ead76f8c82335f85b
Fixed import module
b205836025ceaa6c0edbb9b2ed8cab2c7543968f
Implemented get_user based on the last activity and added the column to the grid view
68529a8640bbaa2834f8a1a14d8d71104a6ca934
Fixed formatting
8d6e529f89548a65a743e88b31ef35457204bf81
Fixed rendering column for last_updated_by
d8b52f1fbfa369a6d746aac5602f1f5b86d67175
Fixed get_user
c9db8baabca7b96a0104deba3f039798225d2335
Added unit tests for Last Updated By column
0266cd3020c961dda57562506c34a0eb21017086
Add class LastUpdatedByColumn and override get_user method
255db9e04b1a4928e07e6a3ead76f8c82335f85b
Fixed import module
b205836025ceaa6c0edbb9b2ed8cab2c7543968f
Implemented get_user based on the last activity and added the column to the grid view
68529a8640bbaa2834f8a1a14d8d71104a6ca934
Fixed formatting
8d6e529f89548a65a743e88b31ef35457204bf81
Fixed rendering column for last_updated_by
d8b52f1fbfa369a6d746aac5602f1f5b86d67175
Fixed get_user
c9db8baabca7b96a0104deba3f039798225d2335
Added unit tests for Last Updated By column
0266cd3020c961dda57562506c34a0eb21017086
Fixed line too long error
1b6a908d77f50b5187a88cbf4ed9bfd95d73315e

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

CL
chipx86
  1. 
      
  2. reviewboard/datagrids/columns.py (Diff revision 5)
     
     
     
     
    Show all issues

    Docstrings need to conform to our documentation guidelines. Look for other functions like get_user and make sure you're following that pattern. This needs to have Args and Returns sections.

    A function's summary should succintly describe its purpose. The description is used for additional details. Keep this high-level: The fact that it's using get_last_activity_info() is an implementation detail that' best left to the code. The reader doesn't care. They care about hte purpose of the function.

  3. reviewboard/datagrids/columns.py (Diff revision 5)
     
     
    Show all issues

    All variables in our Python code use snake_case pattern, rather than camelCase.

  4. reviewboard/datagrids/columns.py (Diff revision 5)
     
     
    Show all issues

    This is being set and then overridden below. Doesn't seem like this needs to be set here, because of that.

  5. reviewboard/datagrids/columns.py (Diff revision 5)
     
     
     
    Show all issues

    Something important to note here is that we can't necessarily assume that the review request's owner is the user that performed the update. For review requests, the changedesc object is also returned. This is the "Review request changed" box. An administrator, or special users, can make changes on a review request on another user's behalf, and the user that did that is in changedesc.user.

  6. reviewboard/datagrids/columns.py (Diff revision 5)
     
     
     
    Show all issues

    This can cause problems down the road if we introduce more types of objects and one of them isn't owner. Each check should be very explicit about what object we're working with, and any else: should probably raise an AssertionError if the user isn't an expected type (with a useful message).

  7. reviewboard/datagrids/grids.py (Diff revision 5)
     
     
     
    Show all issues

    Imports should always be in alphabetical order.

  8. reviewboard/datagrids/grids.py (Diff revision 5)
     
     
     
     
    Show all issues

    The last parameter of a function call shouldn't have a trailing comma. The ) should be on the same line as the last parameter, as well. Note the other columns in this class.

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

    This doesn't seem to be related to your change, so it should be reverted.

  10. reviewboard/datagrids/tests.py (Diff revision 5)
     
     
     
    Show all issues

    This will also need to be in alphabetical order.

  11. reviewboard/datagrids/tests.py (Diff revision 5)
     
     
    Show all issues

    This from .. import .. also needs to be in alphabetical order within the list of all imports.

  12. reviewboard/datagrids/tests.py (Diff revision 5)
     
     
    Show all issues

    This is only used if the column is testing with a LocalSite. None of these are, from what I can see.

  13. reviewboard/datagrids/tests.py (Diff revision 5)
     
     
     
    Show all issues

    The trailing """ must be on its own line when it's a multi-line docstring.

    Also, this docstring doesn't say what is being tested. This should explicitly list the column name. Look at other unit tests in this file.

  14. reviewboard/datagrids/tests.py (Diff revision 5)
     
     
     
    Show all issues

    Several of our test objects use the same usernames, which can create false-positives in username-based tests. Your code should explicitly create a user for each test that we want to check for, make sure the right object is being created with that user, and then use that user for any checks.

  15. reviewboard/datagrids/tests.py (Diff revision 5)
     
     
     
     
    Show all issues

    We're not testing get_last_activity_info(). This could would be better served testing get_user() on the column.

  16. reviewboard/datagrids/tests.py (Diff revision 5)
     
     
     
     
    Show all issues

    For each of these, these usernames very well may be the correct ones, but there's nothing currently indicating that we know for sure. The code isn't tying these to the objects the usernames are coming from. We should explicitly use those.

  17. reviewboard/datagrids/tests.py (Diff revision 5)
     
     
     
     
     
     
    Show all issues

    These are probably wrapping prematurely.

    Same with the other unit tests.

  18. 
      
CL
Review request changed
Testing Done:
   

Manual testing:

    1. On the UI, activate the new Last Updated By column by selecting it.
    2. It should show the user (linkable to the user's profile) that is
    responsible for the last update.
    Tested on Safari, Chrome, and Firefox.

   
   

Automated unit testing:

~   1. Run ./tests/runtests.py reviewboard.datagrids.tests 115 118 119.

  ~ 1. Run ./tests/runtests.py reviewboard.datagrids.tests.

Commits:
Summary ID
Add class LastUpdatedByColumn and override get_user method
255db9e04b1a4928e07e6a3ead76f8c82335f85b
Fixed import module
b205836025ceaa6c0edbb9b2ed8cab2c7543968f
Implemented get_user based on the last activity and added the column to the grid view
68529a8640bbaa2834f8a1a14d8d71104a6ca934
Fixed formatting
8d6e529f89548a65a743e88b31ef35457204bf81
Fixed rendering column for last_updated_by
d8b52f1fbfa369a6d746aac5602f1f5b86d67175
Fixed get_user
c9db8baabca7b96a0104deba3f039798225d2335
Added unit tests for Last Updated By column
0266cd3020c961dda57562506c34a0eb21017086
Fixed line too long error
1b6a908d77f50b5187a88cbf4ed9bfd95d73315e
Removed unused fields in datagrids/tests.py
4e8b1bee638b480283a3e914d9db44a967809691
Add class LastUpdatedByColumn and override get_user method
255db9e04b1a4928e07e6a3ead76f8c82335f85b
Fixed import module
b205836025ceaa6c0edbb9b2ed8cab2c7543968f
Implemented get_user based on the last activity and added the column to the grid view
68529a8640bbaa2834f8a1a14d8d71104a6ca934
Fixed formatting
8d6e529f89548a65a743e88b31ef35457204bf81
Fixed rendering column for last_updated_by
d8b52f1fbfa369a6d746aac5602f1f5b86d67175
Fixed get_user
c9db8baabca7b96a0104deba3f039798225d2335
Added unit tests for Last Updated By column
0266cd3020c961dda57562506c34a0eb21017086
Fixed line too long error
1b6a908d77f50b5187a88cbf4ed9bfd95d73315e
Removed unused fields in datagrids/tests.py
4e8b1bee638b480283a3e914d9db44a967809691
Fixes based on mentor's reviews
bf1ba709d8cf9b4592948efccdac617ae7bc2958

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

CL
Review request changed
Commits:
Summary ID
Add class LastUpdatedByColumn and override get_user method
255db9e04b1a4928e07e6a3ead76f8c82335f85b
Fixed import module
b205836025ceaa6c0edbb9b2ed8cab2c7543968f
Implemented get_user based on the last activity and added the column to the grid view
68529a8640bbaa2834f8a1a14d8d71104a6ca934
Fixed formatting
8d6e529f89548a65a743e88b31ef35457204bf81
Fixed rendering column for last_updated_by
d8b52f1fbfa369a6d746aac5602f1f5b86d67175
Fixed get_user
c9db8baabca7b96a0104deba3f039798225d2335
Added unit tests for Last Updated By column
0266cd3020c961dda57562506c34a0eb21017086
Fixed line too long error
1b6a908d77f50b5187a88cbf4ed9bfd95d73315e
Removed unused fields in datagrids/tests.py
4e8b1bee638b480283a3e914d9db44a967809691
Fixes based on mentor's reviews
bf1ba709d8cf9b4592948efccdac617ae7bc2958
Add class LastUpdatedByColumn and override get_user method
255db9e04b1a4928e07e6a3ead76f8c82335f85b
Fixed import module
b205836025ceaa6c0edbb9b2ed8cab2c7543968f
Implemented get_user based on the last activity and added the column to the grid view
68529a8640bbaa2834f8a1a14d8d71104a6ca934
Fixed formatting
8d6e529f89548a65a743e88b31ef35457204bf81
Fixed rendering column for last_updated_by
d8b52f1fbfa369a6d746aac5602f1f5b86d67175
Fixed get_user
c9db8baabca7b96a0104deba3f039798225d2335
Added unit tests for Last Updated By column
0266cd3020c961dda57562506c34a0eb21017086
Fixed line too long error
1b6a908d77f50b5187a88cbf4ed9bfd95d73315e
Removed unused fields in datagrids/tests.py
4e8b1bee638b480283a3e914d9db44a967809691
Fixes based on mentor's reviews
bf1ba709d8cf9b4592948efccdac617ae7bc2958
Fixed trailing whitespace
445fe015a763bd92edce046b460b2c6ed7623b31

Checks run (2 succeeded)

flake8 passed.
JSHint passed.