Toggling file-by-file mode on an MR will cause links to diffs force the file-by-file on users who follow those links
Summary
We recently rolled out a feature (#233898 (closed)) and one aspect generated some discussion within the Frontend folks of Code Review.
Opening this issue to discuss this widely and see if we're comfortable with this approach or if we should revisit this detail.
When the user toggles the mode, ?fileViewMode=single
or ?fileViewMode=all
gets appended to the URL.
After that, if users copy a link to a diff file or line number, this parameter will be carried in that URL.
Example: Link to a line number
This essentially forces a user-preference on whoever follows that link.
This implementation detail is optional. So it's really a matter of what's the right experience.
Please note: If this doesn't change the URL; there will be no way for a normal user to "guess" the URL that forces file by file.
Steps to reproduce
- Open MR
- Open the Cog Menu
- Toggle file by file mode.
- Check the URL.
- Copy any link to a file or file number or share the link in the address bar to Changes tab
- Toggle it back
- Follow the url copied earlier.
- Notice the file by file mode was forced based on the URL
What is the current bug behavior?
File by file preference is carried in the URL.
Another weird behaviour is that the markdown will re-render the URL as such:
!49298 (diffs)ViewMode=single#5ad64ff6455e7343b07e410069f79f65d801255a_2_1
^ https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49298/diffs?fileViewMode=single#5ad64ff6455e7343b07e410069f79f65d801255a_2_1
What is the expected correct behavior?
(Maybe) Toggling file by file doesn't change the URL.