Add "Previous" and "Next" buttons for commit-by-commit navigation
What does this MR do?
For #18140 (closed)
This MR adds two buttons to the (Diffs) Commit Item component.
If a commit has a prev_commit_id
, a Previous
button is added to seamlessly navigate to the previous commit in the MR.
If the commit has a next_commit_id
, a Next
button is added.
These buttons trigger an action that updates the current commit SHA references in all of the data endpoints, and then requests the metadata again, which effectively overwrites the current state with the new state for the updated SHA.
Once the state has updated, a new watcher in the Diffs app responds to the commit in state changing, and triggers a reload of the Diff Files. Just before, the same watcher pushes a new state into the user's browser History, which updates the browser URL to the correct value.
Because we've added two keyboard shortcuts, this MR also updates the Keyboard Shortcuts Modal (see below) with the new Merge Request Commits
section.
Screenshots
At first commit | At middle commit | At last commit | At only commit |
---|---|---|---|
(buttons are not displayed) |
Keyboard Shortcuts Help Modal |
---|
Does this MR meet the acceptance criteria?
Conformity
Documentation is in a separate MR. Unfortunately, I can't mark it as dependent on this MR.
-
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