Add `manuallyCollapsed` flag to Diff Files
What does this MR do?
For #16047 (closed)
This is one MR in a sequence to improve the way collapsed files are handled in Merge Request diffs.
To create the smallest impact possible, it's broken up into a few steps.
Step | MR | Description |
---|---|---|
1 | !43296 (merged) | Refactor the existing collapsed flags into something more accurate, like automaticallyCollapsed This will leave a small inconsistency where user-collapsed files will be toggling the automaticallyCollapsed property. |
2 | We're here |
Add a flag like userCollapsed alongside the auto flag This will require Vuex actions, mutations, getters ("how many of each type?"), etc. Update the UI to use both flags This will require some resolution code ("which flag wins?"), and various tweaks to the UI code Modify collapsed files to hide the body on userCollapsed and show the warning on automaticallyCollapsed
|
3 | This includes making the warning orange and swapping the text to indicate it was performed automatically. |
This MR adds manuallyCollapsed
to live alongside the existing automaticallyCollapsed
diff file flag.
Notable changes include:
- There's some high-level resolution code so the same - somewhat complex - logic isn't repeated in a bunch of components.
- This code knows about both of the collapsed state flags and incorporates whether the user is in file-by-file mode (if that information is available) to determine if a file should be considered collapsed
- Some actions/mutations are simplified a bit, or common behaviors are extracted
-
⚠ The diff files don't show any body if the user manually collapsed it
Screenshots
Before | After | |
---|---|---|
Automatically collapsed file | ||
Manually collapsed file | ||
Open file | ||
Collapsing | ||
Expanding |
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Edited by Thomas Randolph