Centralize logic for moving to neighboring commits in a Vuex action
What does this MR do?
For #18140 (closed).
Adds an action that allows any consumer to request that the current commit in state be swapped to a neighboring commit (either previous
or next
).
We already have an action for moving to a specific commit, but this requires knowing the correct commit. That means that anywhere in a UI that wants to move among commits (for example: when viewing a MR diff commit-by-commit), will need to calculate what the correct next or previous commit SHA is. This spreads that logic around the codebase too much as soon as there's more than one spot.
This single spot for that logic handles figuring out what the next
or previous
commit is and then defers actually moving to that commit to the changeCurrentCommit
action already available.
Screenshots
N/A, all ~backstage
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