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