Commit b9940c46 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch '201744-remove-ff-stage_all_by_default' into 'master'

Remove feature flag :stage_all_by_default

See merge request gitlab-org/gitlab!24271
parents d53d3a72 9cb894b9
...@@ -6,7 +6,6 @@ import CommitMessageField from './message_field.vue'; ...@@ -6,7 +6,6 @@ import CommitMessageField from './message_field.vue';
import Actions from './actions.vue'; import Actions from './actions.vue';
import SuccessMessage from './success_message.vue'; import SuccessMessage from './success_message.vue';
import { activityBarViews, MAX_WINDOW_HEIGHT_COMPACT } from '../../constants'; import { activityBarViews, MAX_WINDOW_HEIGHT_COMPACT } from '../../constants';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
export default { export default {
components: { components: {
...@@ -15,7 +14,6 @@ export default { ...@@ -15,7 +14,6 @@ export default {
CommitMessageField, CommitMessageField,
SuccessMessage, SuccessMessage,
}, },
mixins: [glFeatureFlagsMixin()],
data() { data() {
return { return {
isCompact: true, isCompact: true,
...@@ -29,12 +27,8 @@ export default { ...@@ -29,12 +27,8 @@ export default {
...mapGetters('commit', ['discardDraftButtonDisabled', 'preBuiltCommitMessage']), ...mapGetters('commit', ['discardDraftButtonDisabled', 'preBuiltCommitMessage']),
overviewText() { overviewText() {
return sprintf( return sprintf(
this.glFeatures.stageAllByDefault __(
? __(
'<strong>%{stagedFilesLength} staged</strong> and <strong>%{changedFilesLength} unstaged</strong> changes', '<strong>%{stagedFilesLength} staged</strong> and <strong>%{changedFilesLength} unstaged</strong> changes',
)
: __(
'<strong>%{changedFilesLength} unstaged</strong> and <strong>%{stagedFilesLength} staged</strong> changes',
), ),
{ {
stagedFilesLength: this.stagedFiles.length, stagedFilesLength: this.stagedFiles.length,
......
...@@ -6,7 +6,6 @@ import Icon from '~/vue_shared/components/icon.vue'; ...@@ -6,7 +6,6 @@ import Icon from '~/vue_shared/components/icon.vue';
import ChangedFileIcon from '~/vue_shared/components/changed_file_icon.vue'; import ChangedFileIcon from '~/vue_shared/components/changed_file_icon.vue';
import NewDropdown from './new_dropdown/index.vue'; import NewDropdown from './new_dropdown/index.vue';
import MrFileIcon from './mr_file_icon.vue'; import MrFileIcon from './mr_file_icon.vue';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
export default { export default {
name: 'FileRowExtra', name: 'FileRowExtra',
...@@ -19,7 +18,6 @@ export default { ...@@ -19,7 +18,6 @@ export default {
ChangedFileIcon, ChangedFileIcon,
MrFileIcon, MrFileIcon,
}, },
mixins: [glFeatureFlagsMixin()],
props: { props: {
file: { file: {
type: Object, type: Object,
...@@ -57,15 +55,10 @@ export default { ...@@ -57,15 +55,10 @@ export default {
return n__('%d staged change', '%d staged changes', this.folderStagedCount); return n__('%d staged change', '%d staged changes', this.folderStagedCount);
} }
return sprintf( return sprintf(__('%{staged} staged and %{unstaged} unstaged changes'), {
this.glFeatures.stageAllByDefault
? __('%{staged} staged and %{unstaged} unstaged changes')
: __('%{unstaged} unstaged and %{staged} staged changes'),
{
unstaged: this.folderUnstagedCount, unstaged: this.folderUnstagedCount,
staged: this.folderStagedCount, staged: this.folderStagedCount,
}, });
);
}, },
showTreeChangesCount() { showTreeChangesCount() {
return this.isTree && this.changesCount > 0 && !this.file.opened; return this.isTree && this.changesCount > 0 && !this.file.opened;
......
...@@ -79,10 +79,7 @@ export const createTempEntry = ( ...@@ -79,10 +79,7 @@ export const createTempEntry = (
if (type === 'blob') { if (type === 'blob') {
commit(types.TOGGLE_FILE_OPEN, file.path); commit(types.TOGGLE_FILE_OPEN, file.path);
if (gon.features?.stageAllByDefault)
commit(types.STAGE_CHANGE, { path: file.path, diffInfo: getters.getDiffInfo(file.path) }); commit(types.STAGE_CHANGE, { path: file.path, diffInfo: getters.getDiffInfo(file.path) });
else commit(types.ADD_FILE_TO_CHANGED, file.path);
dispatch('setFileActive', file.path); dispatch('setFileActive', file.path);
dispatch('triggerFilesChange'); dispatch('triggerFilesChange');
...@@ -250,9 +247,7 @@ export const renameEntry = ({ dispatch, commit, state, getters }, { path, name, ...@@ -250,9 +247,7 @@ export const renameEntry = ({ dispatch, commit, state, getters }, { path, name,
if (isReset) { if (isReset) {
commit(types.REMOVE_FILE_FROM_STAGED_AND_CHANGED, newEntry); commit(types.REMOVE_FILE_FROM_STAGED_AND_CHANGED, newEntry);
} else if (!isInChanges) { } else if (!isInChanges) {
if (gon.features?.stageAllByDefault)
commit(types.STAGE_CHANGE, { path: newPath, diffInfo: getters.getDiffInfo(newPath) }); commit(types.STAGE_CHANGE, { path: newPath, diffInfo: getters.getDiffInfo(newPath) });
else commit(types.ADD_FILE_TO_CHANGED, newPath);
} }
if (!newEntry.tempFile) { if (!newEntry.tempFile) {
......
...@@ -158,9 +158,7 @@ export const changeFileContent = ({ commit, state, getters }, { path, content }) ...@@ -158,9 +158,7 @@ export const changeFileContent = ({ commit, state, getters }, { path, content })
const indexOfChangedFile = state.changedFiles.findIndex(f => f.path === path); const indexOfChangedFile = state.changedFiles.findIndex(f => f.path === path);
if (file.changed && indexOfChangedFile === -1) { if (file.changed && indexOfChangedFile === -1) {
if (gon.features?.stageAllByDefault)
commit(types.STAGE_CHANGE, { path, diffInfo: getters.getDiffInfo(path) }); commit(types.STAGE_CHANGE, { path, diffInfo: getters.getDiffInfo(path) });
else commit(types.ADD_FILE_TO_CHANGED, path);
} else if (!file.changed && !file.tempFile && indexOfChangedFile !== -1) { } else if (!file.changed && !file.tempFile && indexOfChangedFile !== -1) {
commit(types.REMOVE_FILE_FROM_CHANGED, path); commit(types.REMOVE_FILE_FROM_CHANGED, path);
} }
......
...@@ -3,10 +3,6 @@ ...@@ -3,10 +3,6 @@
class IdeController < ApplicationController class IdeController < ApplicationController
layout 'fullscreen' layout 'fullscreen'
before_action do
push_frontend_feature_flag(:stage_all_by_default, default_enabled: true)
end
def index def index
Gitlab::UsageDataCounters::WebIdeCounter.increment_views_count Gitlab::UsageDataCounters::WebIdeCounter.increment_views_count
end end
......
...@@ -472,9 +472,6 @@ msgstr "" ...@@ -472,9 +472,6 @@ msgstr ""
msgid "%{total} open issues" msgid "%{total} open issues"
msgstr "" msgstr ""
msgid "%{unstaged} unstaged and %{staged} staged changes"
msgstr ""
msgid "%{usage_ping_link_start}Learn more%{usage_ping_link_end} about what information is shared with GitLab Inc." msgid "%{usage_ping_link_start}Learn more%{usage_ping_link_end} about what information is shared with GitLab Inc."
msgstr "" msgstr ""
...@@ -733,9 +730,6 @@ msgstr "" ...@@ -733,9 +730,6 @@ msgstr ""
msgid "<no scopes selected>" msgid "<no scopes selected>"
msgstr "" msgstr ""
msgid "<strong>%{changedFilesLength} unstaged</strong> and <strong>%{stagedFilesLength} staged</strong> changes"
msgstr ""
msgid "<strong>%{group_name}</strong> group members" msgid "<strong>%{group_name}</strong> group members"
msgstr "" msgstr ""
......
...@@ -534,27 +534,21 @@ describe('IDE store file actions', () => { ...@@ -534,27 +534,21 @@ describe('IDE store file actions', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('adds a newline to the end of the file if it doesnt already exist', done => { it('adds file into stagedFiles array', done => {
callAction('content') store
.then(() => { .dispatch('changeFileContent', {
expect(tmpFile.content).toBe('content\n'); path: tmpFile.path,
content: 'content',
done();
}) })
.catch(done.fail);
});
it('adds file into changedFiles array', done => {
callAction()
.then(() => { .then(() => {
expect(store.state.changedFiles.length).toBe(1); expect(store.state.stagedFiles.length).toBe(1);
done(); done();
}) })
.catch(done.fail); .catch(done.fail);
}); });
it('adds file not more than once into changedFiles array', done => { it('adds file not more than once into stagedFiles array', done => {
store store
.dispatch('changeFileContent', { .dispatch('changeFileContent', {
path: tmpFile.path, path: tmpFile.path,
...@@ -567,7 +561,7 @@ describe('IDE store file actions', () => { ...@@ -567,7 +561,7 @@ describe('IDE store file actions', () => {
}), }),
) )
.then(() => { .then(() => {
expect(store.state.changedFiles.length).toBe(1); expect(store.state.stagedFiles.length).toBe(1);
done(); done();
}) })
...@@ -594,52 +588,6 @@ describe('IDE store file actions', () => { ...@@ -594,52 +588,6 @@ describe('IDE store file actions', () => {
.catch(done.fail); .catch(done.fail);
}); });
describe('when `gon.feature.stageAllByDefault` is true', () => {
const originalGonFeatures = Object.assign({}, gon.features);
beforeAll(() => {
gon.features = { stageAllByDefault: true };
});
afterAll(() => {
gon.features = originalGonFeatures;
});
it('adds file into stagedFiles array', done => {
store
.dispatch('changeFileContent', {
path: tmpFile.path,
content: 'content',
})
.then(() => {
expect(store.state.stagedFiles.length).toBe(1);
done();
})
.catch(done.fail);
});
it('adds file not more than once into stagedFiles array', done => {
store
.dispatch('changeFileContent', {
path: tmpFile.path,
content: 'content',
})
.then(() =>
store.dispatch('changeFileContent', {
path: tmpFile.path,
content: 'content 123',
}),
)
.then(() => {
expect(store.state.stagedFiles.length).toBe(1);
done();
})
.catch(done.fail);
});
});
it('bursts unused seal', done => { it('bursts unused seal', done => {
store store
.dispatch('changeFileContent', { .dispatch('changeFileContent', {
......
...@@ -61,19 +61,14 @@ describe('IDE store integration', () => { ...@@ -61,19 +61,14 @@ describe('IDE store integration', () => {
store.dispatch('createTempEntry', { name: TEST_PATH, type: 'blob' }); store.dispatch('createTempEntry', { name: TEST_PATH, type: 'blob' });
}); });
it('has changed and staged', () => { it('is added to staged as modified', () => {
expect(store.state.changedFiles).toEqual([
expect.objectContaining({
path: TEST_PATH,
tempFile: true,
deleted: false,
}),
]);
expect(store.state.stagedFiles).toEqual([ expect(store.state.stagedFiles).toEqual([
expect.objectContaining({ expect.objectContaining({
path: TEST_PATH, path: TEST_PATH,
deleted: true, deleted: false,
staged: true,
changed: true,
tempFile: false,
}), }),
]); ]);
}); });
......
...@@ -52,7 +52,7 @@ describe('IDE commit form', () => { ...@@ -52,7 +52,7 @@ describe('IDE commit form', () => {
vm.$store.state.stagedFiles.push('test'); vm.$store.state.stagedFiles.push('test');
vm.$nextTick(() => { vm.$nextTick(() => {
expect(vm.$el.querySelector('p').textContent).toContain('1 unstaged and 1 staged changes'); expect(vm.$el.querySelector('p').textContent).toContain('1 staged and 1 unstaged changes');
done(); done();
}); });
}); });
......
...@@ -63,7 +63,7 @@ describe('IDE extra file row component', () => { ...@@ -63,7 +63,7 @@ describe('IDE extra file row component', () => {
stagedFilesCount = 1; stagedFilesCount = 1;
unstagedFilesCount = 1; unstagedFilesCount = 1;
expect(vm.folderChangesTooltip).toBe('1 unstaged and 1 staged changes'); expect(vm.folderChangesTooltip).toBe('1 staged and 1 unstaged changes');
}); });
}); });
......
...@@ -225,35 +225,6 @@ describe('Multi-file store actions', () => { ...@@ -225,35 +225,6 @@ describe('Multi-file store actions', () => {
.catch(done.fail); .catch(done.fail);
}); });
describe('when `gon.feature.stageAllByDefault` is true', () => {
const originalGonFeatures = Object.assign({}, gon.features);
beforeAll(() => {
gon.features = { stageAllByDefault: true };
});
afterAll(() => {
gon.features = originalGonFeatures;
});
it('adds tmp file to staged files', done => {
const name = 'test';
store
.dispatch('createTempEntry', {
name,
branchId: 'mybranch',
type: 'blob',
})
.then(() => {
expect(store.state.stagedFiles).toEqual([jasmine.objectContaining({ name })]);
done();
})
.catch(done.fail);
});
});
it('adds tmp file to open files', done => { it('adds tmp file to open files', done => {
const name = 'test'; const name = 'test';
...@@ -274,7 +245,7 @@ describe('Multi-file store actions', () => { ...@@ -274,7 +245,7 @@ describe('Multi-file store actions', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('adds tmp file to changed files', done => { it('adds tmp file to staged files', done => {
const name = 'test'; const name = 'test';
store store
...@@ -284,9 +255,7 @@ describe('Multi-file store actions', () => { ...@@ -284,9 +255,7 @@ describe('Multi-file store actions', () => {
type: 'blob', type: 'blob',
}) })
.then(() => { .then(() => {
expect(store.state.changedFiles).toEqual([ expect(store.state.stagedFiles).toEqual([jasmine.objectContaining({ name })]);
jasmine.objectContaining({ name, tempFile: true }),
]);
done(); done();
}) })
...@@ -294,15 +263,9 @@ describe('Multi-file store actions', () => { ...@@ -294,15 +263,9 @@ describe('Multi-file store actions', () => {
}); });
it('sets tmp file as active', () => { it('sets tmp file as active', () => {
const dispatch = jasmine.createSpy(); createTempEntry(store, { name: 'test', branchId: 'mybranch', type: 'blob' });
const commit = jasmine.createSpy();
createTempEntry( expect(store.dispatch).toHaveBeenCalledWith('setFileActive', 'test');
{ state: store.state, getters: store.getters, dispatch, commit },
{ name: 'test', branchId: 'mybranch', type: 'blob' },
);
expect(dispatch).toHaveBeenCalledWith('setFileActive', 'test');
}); });
it('creates flash message if file already exists', done => { it('creates flash message if file already exists', done => {
...@@ -804,17 +767,6 @@ describe('Multi-file store actions', () => { ...@@ -804,17 +767,6 @@ describe('Multi-file store actions', () => {
}); });
}); });
describe('when `gon.feature.stageAllByDefault` is true', () => {
const originalGonFeatures = Object.assign({}, gon.features);
beforeAll(() => {
gon.features = { stageAllByDefault: true };
});
afterAll(() => {
gon.features = originalGonFeatures;
});
it('by default renames an entry and stages it', () => { it('by default renames an entry and stages it', () => {
const dispatch = jasmine.createSpy(); const dispatch = jasmine.createSpy();
const commit = jasmine.createSpy(); const commit = jasmine.createSpy();
...@@ -829,31 +781,6 @@ describe('Multi-file store actions', () => { ...@@ -829,31 +781,6 @@ describe('Multi-file store actions', () => {
[types.STAGE_CHANGE, jasmine.objectContaining({ path: 'renamed' })], [types.STAGE_CHANGE, jasmine.objectContaining({ path: 'renamed' })],
]); ]);
}); });
});
it('by default renames an entry and adds to changed', done => {
testAction(
renameEntry,
{ path: 'orig', name: 'renamed' },
store.state,
[
{
type: types.RENAME_ENTRY,
payload: {
path: 'orig',
name: 'renamed',
parentPath: undefined,
},
},
{
type: types.ADD_FILE_TO_CHANGED,
payload: 'renamed',
},
],
jasmine.any(Object),
done,
);
});
it('if not changed, completely unstages and discards entry if renamed to original', done => { it('if not changed, completely unstages and discards entry if renamed to original', done => {
testAction( testAction(
......
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