Commit 6fbe7503 authored by Mark Florian's avatar Mark Florian

Merge branch 'jdb/feature-flag-merge-ref-head' into 'master'

Add feature flag for merge_ref_head

See merge request gitlab-org/gitlab!29738
parents dac8cf9a 7b0a73e7
...@@ -39,7 +39,11 @@ export const diffCompareDropdownTargetVersions = (state, getters) => { ...@@ -39,7 +39,11 @@ export const diffCompareDropdownTargetVersions = (state, getters) => {
...v, ...v,
}; };
}; };
if (gon.features?.diffCompareWithHead) {
return [...state.mergeRequestDiffs.slice(1).map(formatVersion), baseVersion, headVersion]; return [...state.mergeRequestDiffs.slice(1).map(formatVersion), baseVersion, headVersion];
}
return [...state.mergeRequestDiffs.slice(1).map(formatVersion), baseVersion];
}; };
export const diffCompareDropdownSourceVersions = (state, getters) => { export const diffCompareDropdownSourceVersions = (state, getters) => {
......
...@@ -26,6 +26,7 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo ...@@ -26,6 +26,7 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
push_frontend_feature_flag(:code_navigation, @project) push_frontend_feature_flag(:code_navigation, @project)
push_frontend_feature_flag(:widget_visibility_polling, @project, default_enabled: true) push_frontend_feature_flag(:widget_visibility_polling, @project, default_enabled: true)
push_frontend_feature_flag(:merge_ref_head_comments, @project) push_frontend_feature_flag(:merge_ref_head_comments, @project)
push_frontend_feature_flag(:diff_compare_with_head, @project)
end end
before_action do before_action do
......
...@@ -67,6 +67,26 @@ current default comparison. ...@@ -67,6 +67,26 @@ current default comparison.
![Merge request versions compare HEAD](img/versions_compare_head_v12_10.png) ![Merge request versions compare HEAD](img/versions_compare_head_v12_10.png)
### Enable or disable `HEAD` comparison mode **(CORE ONLY)**
`HEAD` comparison mode is under development and not ready for production use. It is
deployed behind a feature flag that is **disabled by default**.
[GitLab administrators with access to the GitLab Rails console](../../../administration/troubleshooting/navigating_gitlab_via_rails_console.md#starting-a-rails-console-session)
can enable it for your instance. You're welcome to test it, but use it at your
own risk.
To enable it:
```ruby
Feature.enable(:diff_compare_with_head)
```
To disable it:
```ruby
Feature.disable(:diff_compare_with_head)
```
<!-- ## Troubleshooting <!-- ## Troubleshooting
Include any troubleshooting steps that you can foresee. If you know beforehand what issues Include any troubleshooting steps that you can foresee. If you know beforehand what issues
......
...@@ -18,6 +18,7 @@ describe('Compare diff version dropdowns', () => { ...@@ -18,6 +18,7 @@ describe('Compare diff version dropdowns', () => {
}; };
localState.targetBranchName = 'baseVersion'; localState.targetBranchName = 'baseVersion';
localState.mergeRequestDiffs = diffsMockData; localState.mergeRequestDiffs = diffsMockData;
gon.features = { diffCompareWithHead: true };
}); });
describe('selectedTargetIndex', () => { describe('selectedTargetIndex', () => {
...@@ -128,6 +129,14 @@ describe('Compare diff version dropdowns', () => { ...@@ -128,6 +129,14 @@ describe('Compare diff version dropdowns', () => {
}); });
assertVersions(targetVersions); assertVersions(targetVersions);
}); });
it('does not list head version if feature flag is not enabled', () => {
gon.features = { diffCompareWithHead: false };
setupTest();
const targetVersions = getters.diffCompareDropdownTargetVersions(localState, getters);
expect(targetVersions.find(version => version.isHead)).toBeUndefined();
});
}); });
it('diffCompareDropdownSourceVersions', () => { it('diffCompareDropdownSourceVersions', () => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment