Commit 98f1ce3e authored by Thomas Randolph's avatar Thomas Randolph

Integrate with single diff type feature flag

This commit pushes the single_mr_diff_view 
feature flag into the glFeatures JavaScript 
object as soon as the merge requests controller 
starts up.

Because that feature flag is needed in the Vuex 
actions and mutations, as soon as the Diffs Vue 
app starts, it also takes that feature flag and puts 
it into state.
parent 95268679
......@@ -177,6 +177,7 @@ export default {
projectPath: this.projectPath,
dismissEndpoint: this.dismissEndpoint,
showSuggestPopover: this.showSuggestPopover,
useSingleDiffStyle: this.glFeatures.singleMrDiffView,
});
if (this.shouldShow) {
......
......@@ -46,6 +46,7 @@ export const setBaseConfig = ({ commit }, options) => {
projectPath,
dismissEndpoint,
showSuggestPopover,
useSingleDiffStyle,
} = options;
commit(types.SET_BASE_CONFIG, {
endpoint,
......@@ -54,11 +55,15 @@ export const setBaseConfig = ({ commit }, options) => {
projectPath,
dismissEndpoint,
showSuggestPopover,
useSingleDiffStyle,
});
};
export const fetchDiffFiles = ({ state, commit }) => {
const worker = new TreeWorker();
const urlParams = {
w: state.showWhitespace ? '0' : '1',
};
commit(types.SET_LOADING, true);
......@@ -69,9 +74,10 @@ export const fetchDiffFiles = ({ state, commit }) => {
});
return axios
.get(mergeUrlParams({ w: state.showWhitespace ? '0' : '1' }, state.endpoint))
.get(mergeUrlParams(urlParams, state.endpoint))
.then(res => {
commit(types.SET_LOADING, false);
commit(types.SET_MERGE_REQUEST_DIFFS, res.data.merge_request_diffs || []);
commit(types.SET_DIFF_DATA, res.data);
......
......@@ -31,4 +31,5 @@ export default () => ({
fileFinderVisible: false,
dismissEndpoint: '',
showSuggestPopover: true,
useSingleDiffStyle: false,
});
......@@ -19,6 +19,7 @@ export default {
projectPath,
dismissEndpoint,
showSuggestPopover,
useSingleDiffStyle,
} = options;
Object.assign(state, {
endpoint,
......@@ -27,6 +28,7 @@ export default {
projectPath,
dismissEndpoint,
showSuggestPopover,
useSingleDiffStyle,
});
},
......
......@@ -20,6 +20,7 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
before_action :check_user_can_push_to_source_branch!, only: [:rebase]
before_action only: [:show] do
push_frontend_feature_flag(:diffs_batch_load, @project)
push_frontend_feature_flag(:single_mr_diff_view, @project)
end
before_action do
......
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