Add hiding min files by default
Review Request #10715 — Created Sept. 15, 2019 and updated
When adding minified files for review the entire file is displayed in
the diff veiwer. Since min files are just one long line this does not
make sense to display as they are generally ignored in the review
process. With this change files matching the search .min. are hidden
by default with the option to display them if the reviewer clicks
"Show content". This is similar to how deleted files are handled in the
diff viewer. Since deleted and hidden files are very similar in
functionality I merged the fields into one hidden field with an
optional hidden_context if there is need to know the reason for a file
being hidden.
Included tests for these changes.
Summary | ID |
---|---|
5773f493e25a882435a9b80385d25c4cd3bfa25c | |
276cef5046ec8eca751fb4ddfe876f6a47320744 | |
4ff5f0819b4b6ffa1e61b3a5c66c3173d5d97caa | |
4c9aef2a23627d1bbf44bcd0cefa63fdd33c8d21 |
Description | From | Last Updated |
---|---|---|
Can you flesh out your description and testing done? See https://www.notion.so/reviewboard/Writing-Good-Change-Descriptions-10529e7c207743fa8ca90153d4b21fea#writinggoodchangedescriptions |
david | |
We should probably explain why it is hidden instead of just stating that it is. e.g., This file was hidden … |
brennie | |
E122 continuation line missing indentation or outdented |
reviewbot | |
E226 missing whitespace around arithmetic operator |
reviewbot | |
Single quotes for strings. |
brennie | |
It is more Pythonic to do elif '.min.' in depot_filename: (and also more readable). |
brennie | |
nit: blank line between these. |
brennie | |
This only tests the cumulative diff (ie the squashed version of all the commits) case. Can you add a a … |
brennie | |
nit: blank line between these. |
brennie | |
nit: we do django template indentation a little differently: the indentation occurs inside the block tags. Additionally, HTML is indented … |
brennie | |
Let's expand this comment just a little bit. How about: # Choose the most important information to show for why … |
david | |
I know it's not part of your change per se, but this is leftover debug output and can be removed. |
david | |
Can we move these new tests to be at the end of this suite? Right now they break up a … |
david | |
How about "Testing get_diff_files hiding of deleted/minified files for a diffset with history"? That line can wrap as needed. |
david | |
Please change out the " quotes for ' quotes. |
david | |
How about "Testing get_diff_files hiding of deleted/minified files for an individual commit"? That line can wrap as needed. |
david | |
Please change out the " quotes for ' quotes. |
david | |
This needs to use an exact equality comparison operator (===) |
david | |
The way this is laid out is a little bit error-prone (we're kind of interleaving the if/else clauses and HTML … |
david | |
This doesn't really make sense. Either a file is empty (no content) or minified (lots of content all squished together). … |
david | |
Please undo. This is here for debugging test failures. |
brennie |
- Description:
-
~ Add hiding min files by default
~ When adding minified files for review the entire file is displayed in the diff veiwer. Since min files are just one long line this does not make sense to display as they are generally ignored in the review process. With this change files matching the search .min. are hiddent by default with the option to display them if the reviewer clicks "Show content". This is similar to how deleted files are handled in the diff viewer. Since deleted and hidden files are very similar in functionality I merged the fields into one hidden field with an optional hidden_context if there is need to know the reason for a file being hidden.
- Commits:
-
Summary ID Author 124c6b115e7812d8434258e83bf6048913287ef1 ceegan 124c6b115e7812d8434258e83bf6048913287ef1 ceegan 0fa0dfaf9e1ffac97ce6622337cf086a02b91962 ceegan - Diff:
-
Revision 2 (+1956 -1806)
Checks run (2 succeeded)
-
-
We should probably explain why it is hidden instead of just stating that it is. e.g.,
This file was hidden because it is likely minified. Show content.
-
-
-
-
This only tests the cumulative diff (ie the squashed version of all the commits) case.
Can you add a a test to make sure it works for the individual commits as well?
-
-
nit: we do django template indentation a little differently: the indentation occurs inside the block tags. Additionally, HTML is indented one space (irrespective of the django tag indentation), e.g.:
{% elif file.hide and not show_deleted %} {% if file.hide_context == 'deleted' %} <tbody> <tr> <td colspan="4"> {% if file.num_changes == 0 %} {% trans "..." %}
- Commits:
-
Summary ID Author 124c6b115e7812d8434258e83bf6048913287ef1 ceegan 0fa0dfaf9e1ffac97ce6622337cf086a02b91962 ceegan ee4bd9ec433332bd92d603564049e92b1454ede1 Ceegan Hale 797cf58196b195f8eac6c5c696fb477c90665566 Ceegan Hale - Diff:
-
Revision 3 (+298 -50)
Checks run (2 succeeded)
- Commits:
-
Summary ID ee4bd9ec433332bd92d603564049e92b1454ede1 797cf58196b195f8eac6c5c696fb477c90665566 ee4bd9ec433332bd92d603564049e92b1454ede1 797cf58196b195f8eac6c5c696fb477c90665566 49a4e7bc316301cc43d8e4e0d9e69bec144a6630 - Diff:
-
Revision 4 (+297 -51)
Checks run (2 succeeded)
- Commits:
-
Summary ID ee4bd9ec433332bd92d603564049e92b1454ede1 797cf58196b195f8eac6c5c696fb477c90665566 49a4e7bc316301cc43d8e4e0d9e69bec144a6630 b3aaae4aa8b78e5ac30c2d8800c469be10d41057 - Diff:
-
Revision 5 (+296 -50)
Checks run (2 succeeded)
-
-
Let's expand this comment just a little bit. How about:
# Choose the most important information to show for why a # file is hidden. If a minified file is deleted, prefer to # show it as deleted.
-
-
Can we move these new tests to be at the end of this suite? Right now they break up a bunch of other more related tests.
-
How about "Testing get_diff_files hiding of deleted/minified files for a diffset with history"?
That line can wrap as needed.
-
-
How about "Testing get_diff_files hiding of deleted/minified files for an individual commit"?
That line can wrap as needed.
-
-
-
The way this is laid out is a little bit error-prone (we're kind of interleaving the if/else clauses and HTML tags). We can simplify it a lot by pulling the
tbody
class name out into a variable:{% definevar "tbody_class" %}{% spaceless %} {% if file.hide_context == "deleted" %} deleted {% else %} hidden {% endif %} {% endspaceless %}{% enddefinevar %} <tbody class="{{tbody_class}}"> <tr> <td colspan="4"> {% if file.hide_context == "deleted" %} ... {% endif %} </td> </tr> </tbody>
-
This doesn't really make sense. Either a file is empty (no content) or minified (lots of content all squished together).
I think if a file is empty we should always show the "This is an empty file" line.
- Commits:
-
Summary ID b3aaae4aa8b78e5ac30c2d8800c469be10d41057 b3aaae4aa8b78e5ac30c2d8800c469be10d41057 c8697a78c5e4c5bd1f68324f4a131ff91c871cf6 - Diff:
-
Revision 6 (+388 -136)
Checks run (2 succeeded)
- Description:
-
~ When adding minified files for review the entire file is displayed in the diff veiwer. Since min files are just one long line this does not make sense to display as they are generally ignored in the review process. With this change files matching the search .min. are hiddent by default with the option to display them if the reviewer clicks "Show content". This is similar to how deleted files are handled in the diff viewer. Since deleted and hidden files are very similar in functionality I merged the fields into one hidden field with an optional hidden_context if there is need to know the reason for a file being hidden.
~ When adding minified files for review the entire file is displayed in
+ the diff veiwer. Since min files are just one long line this does not + make sense to display as they are generally ignored in the review + process. With this change files matching the search .min. are hidden + by default with the option to display them if the reviewer clicks + "Show content". This is similar to how deleted files are handled in the + diff viewer. Since deleted and hidden files are very similar in + functionality I merged the fields into one hidden field with an + optional hidden_context if there is need to know the reason for a file + being hidden. - Testing Done:
-
+ Included tests for these changes.
- Commits:
-
Summary ID b3aaae4aa8b78e5ac30c2d8800c469be10d41057 c8697a78c5e4c5bd1f68324f4a131ff91c871cf6 5773f493e25a882435a9b80385d25c4cd3bfa25c 276cef5046ec8eca751fb4ddfe876f6a47320744 4ff5f0819b4b6ffa1e61b3a5c66c3173d5d97caa 4c9aef2a23627d1bbf44bcd0cefa63fdd33c8d21 - Diff:
-
Revision 7 (+393 -137)