Commit b104dc11 authored by Himanshu Kapoor's avatar Himanshu Kapoor Committed by Paul Slaughter

Burst unused seal on new file and rename

Call action burstUnusedSeal on creation of a new file and renaming an
existing file. This prevents a "No changes" empty state from being
shown despite there clearly being changes.
parent bf7edb28
...@@ -110,6 +110,7 @@ export const createTempEntry = ( ...@@ -110,6 +110,7 @@ export const createTempEntry = (
commit(types.ADD_FILE_TO_CHANGED, file.path); commit(types.ADD_FILE_TO_CHANGED, file.path);
dispatch('setFileActive', file.path); dispatch('setFileActive', file.path);
dispatch('triggerFilesChange'); dispatch('triggerFilesChange');
dispatch('burstUnusedSeal');
} }
if (parentPath && !state.entries[parentPath].opened) { if (parentPath && !state.entries[parentPath].opened) {
...@@ -222,7 +223,9 @@ export const deleteEntry = ({ commit, dispatch, state }, path) => { ...@@ -222,7 +223,9 @@ export const deleteEntry = ({ commit, dispatch, state }, path) => {
dispatch('deleteEntry', prevPath); dispatch('deleteEntry', prevPath);
return; return;
} }
if (state.unusedSeal) dispatch('burstUnusedSeal');
dispatch('burstUnusedSeal');
if (entry.opened) dispatch('closeFile', entry); if (entry.opened) dispatch('closeFile', entry);
if (isTree) { if (isTree) {
...@@ -267,6 +270,7 @@ export const renameEntry = ({ dispatch, commit, state }, { path, name, parentPat ...@@ -267,6 +270,7 @@ export const renameEntry = ({ dispatch, commit, state }, { path, name, parentPat
commit(types.REMOVE_FILE_FROM_STAGED_AND_CHANGED, newEntry); commit(types.REMOVE_FILE_FROM_STAGED_AND_CHANGED, newEntry);
} else if (!isInChanges) { } else if (!isInChanges) {
commit(types.ADD_FILE_TO_CHANGED, newPath); commit(types.ADD_FILE_TO_CHANGED, newPath);
dispatch('burstUnusedSeal');
} }
if (!newEntry.tempFile) { if (!newEntry.tempFile) {
......
---
title: Fix "No changes" empty state showing up in changes tab, despite there being
changes
merge_request: 21713
author:
type: fixed
...@@ -319,7 +319,7 @@ describe('Multi-file store actions', () => { ...@@ -319,7 +319,7 @@ describe('Multi-file store actions', () => {
{ type: types.TOGGLE_FILE_OPEN, payload: 'test' }, { type: types.TOGGLE_FILE_OPEN, payload: 'test' },
{ type: types.ADD_FILE_TO_CHANGED, payload: 'test' }, { type: types.ADD_FILE_TO_CHANGED, payload: 'test' },
], ],
[ jasmine.objectContaining([
{ {
type: 'setFileActive', type: 'setFileActive',
payload: 'test', payload: 'test',
...@@ -327,7 +327,7 @@ describe('Multi-file store actions', () => { ...@@ -327,7 +327,7 @@ describe('Multi-file store actions', () => {
{ {
type: 'triggerFilesChange', type: 'triggerFilesChange',
}, },
], ]),
done, done,
); );
}); });
...@@ -350,6 +350,21 @@ describe('Multi-file store actions', () => { ...@@ -350,6 +350,21 @@ describe('Multi-file store actions', () => {
}) })
.catch(done.fail); .catch(done.fail);
}); });
it('bursts unused seal', done => {
store
.dispatch('createTempEntry', {
name: 'test',
branchId: 'mybranch',
type: 'blob',
})
.then(() => {
expect(store.state.unusedSeal).toBe(false);
done();
})
.catch(done.fail);
});
}); });
}); });
...@@ -648,6 +663,19 @@ describe('Multi-file store actions', () => { ...@@ -648,6 +663,19 @@ describe('Multi-file store actions', () => {
], ],
); );
}); });
it('bursts unused seal', done => {
store.state.entries.test = file('test');
store
.dispatch('deleteEntry', 'test')
.then(() => {
expect(store.state.unusedSeal).toBe(false);
done();
})
.catch(done.fail);
});
}); });
describe('renameEntry', () => { describe('renameEntry', () => {
...@@ -747,7 +775,7 @@ describe('Multi-file store actions', () => { ...@@ -747,7 +775,7 @@ describe('Multi-file store actions', () => {
payload: 'renamed', payload: 'renamed',
}, },
], ],
[{ type: 'triggerFilesChange' }], [{ type: 'burstUnusedSeal' }, { type: 'triggerFilesChange' }],
done, done,
); );
}); });
...@@ -807,6 +835,20 @@ describe('Multi-file store actions', () => { ...@@ -807,6 +835,20 @@ describe('Multi-file store actions', () => {
.then(done) .then(done)
.catch(done.fail); .catch(done.fail);
}); });
it('bursts unused seal', done => {
store
.dispatch('renameEntry', {
path: 'orig',
name: 'renamed',
})
.then(() => {
expect(store.state.unusedSeal).toBe(false);
done();
})
.catch(done.fail);
});
}); });
describe('folder', () => { describe('folder', () => {
......
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