summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Zallmann <tzallmann@gitlab.com>2018-01-15 19:11:56 +0100
committerTim Zallmann <tzallmann@gitlab.com>2018-01-15 19:11:56 +0100
commit011c33e70031c5b75ca6ac7900bd854c8e0542f9 (patch)
tree0fc1217878188860c21fbfd3217cc1046893007f
parent522a4368b3f7a22fbdc91170466aadf55a310510 (diff)
downloadgitlab-ce-011c33e70031c5b75ca6ac7900bd854c8e0542f9.tar.gz
Fix for Resetting Last COmmit Data
-rw-r--r--app/assets/javascripts/ide/stores/actions.js7
-rw-r--r--spec/javascripts/repo/stores/actions_spec.js13
2 files changed, 4 insertions, 16 deletions
diff --git a/app/assets/javascripts/ide/stores/actions.js b/app/assets/javascripts/ide/stores/actions.js
index 5b1f6e7ddae..90602efa8be 100644
--- a/app/assets/javascripts/ide/stores/actions.js
+++ b/app/assets/javascripts/ide/stores/actions.js
@@ -107,7 +107,7 @@ export const commitChanges = (
let commitMsg = `Your changes have been committed. Commit ${data.short_id}`;
if (data.stats) {
- commitMsg += `with ${data.stats.additions} additions, ${data.stats.deletions} deletions.`;
+ commitMsg += ` with ${data.stats.additions} additions, ${data.stats.deletions} deletions.`;
}
flash(
@@ -116,9 +116,8 @@ export const commitChanges = (
);
window.dispatchEvent(new Event('resize'));
- dispatch('discardAllChanges');
-
if (newMr) {
+ dispatch('discardAllChanges');
dispatch(
'redirectToUrl',
`${selectedProject.web_url}/merge_requests/new?merge_request%5Bsource_branch%5D=${branch}`,
@@ -137,6 +136,8 @@ export const commitChanges = (
});
});
+ dispatch('discardAllChanges');
+
window.scrollTo(0, 0);
}
})
diff --git a/spec/javascripts/repo/stores/actions_spec.js b/spec/javascripts/repo/stores/actions_spec.js
index 0b0d34f072a..853ef7f3224 100644
--- a/spec/javascripts/repo/stores/actions_spec.js
+++ b/spec/javascripts/repo/stores/actions_spec.js
@@ -300,19 +300,6 @@ describe('Multi-file store actions', () => {
}).catch(done.fail);
});
- it('closes all files', (done) => {
- store.state.openFiles.push(file());
- store.state.openFiles[0].opened = true;
-
- store.dispatch('commitChanges', { payload, newMr: false })
- .then(Vue.nextTick)
- .then(() => {
- expect(store.state.openFiles.length).toBe(0);
-
- done();
- }).catch(done.fail);
- });
-
it('scrolls to top of page', (done) => {
store.dispatch('commitChanges', { payload, newMr: false })
.then(() => {