Add ability to collapse entire files in the diff view.
Review Request #9337 - Created Oct. 28, 2017 and updated
When viewing the diff of a review request not all files need to be viewed, for example minified files don't need to be reviewed. It is also helpful to have a way to hide files you have already reviewed. Now files can be collapsed and expanded as the user wishes. Also, minified files are collapsed by default.
This has not been tested yet, and there are use cases that I know
I haven't covered yet (for example, this doesn't work for a binary
file right now).
I just wanted to get feedback on what I've done so far, and find
out if I should be doing anything differently before I continue.
Also it might be worth mentioning that because the existing
"Collapse changes" button reloads the page, any files that were
manually collapsed or expanded will return to their default state.
|If there's a newly-added minified filename, I think depot_filename will be None, which might crash. This should also use single ...||David Trowbridge|
If there's a newly-added minified filename, I think
None, which might crash. This should also use single quotes, and probably test for
This comment should have an "Args" section explaining what
Because this is ES6, we can use a slightly shorter syntax:
These should use
Should be indented only 1 space within its parent.
Revision 2 (+71 -11)
Checks run (2 succeeded)
Don't know if this is helpful at all, or even a part of the requirements of your project, but if you did want to maintain the collapsed state of your elements even after page reload, you could save a list of collapsed file ids under an object in browser storage (probably local storage) indexed by the current review request id. If the list under the review request id exists, use it to determine which elements should be collapsed on client-side loading. If it doesn't, remove all other currently saved review request collapsed-lists (to not use up a bunch of local storage space).