diff options
author | Phil Hughes <me@iamphill.com> | 2018-03-27 14:48:51 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-03-28 14:08:34 +0100 |
commit | babb90a7af6f691739f6d600d00f30b88f697dc4 (patch) | |
tree | fd1d4a6207aa59d02137daa7620ee28e8fdae7ec | |
parent | 8c4ad7385dab6dd3b50fbcb51605bc8abe81126a (diff) | |
download | gitlab-ce-babb90a7af6f691739f6d600d00f30b88f697dc4.tar.gz |
replace the tab with the review pending tab
-rw-r--r-- | app/assets/javascripts/ide/stores/mutations/file.js | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/app/assets/javascripts/ide/stores/mutations/file.js b/app/assets/javascripts/ide/stores/mutations/file.js index 83db5664912..0d878d6c6e5 100644 --- a/app/assets/javascripts/ide/stores/mutations/file.js +++ b/app/assets/javascripts/ide/stores/mutations/file.js @@ -100,13 +100,7 @@ export default { const pendingTab = state.openFiles.find(f => f.path === file.path && f.pending); Object.assign(state, { - openFiles: state.openFiles.map(f => { - if (!f.pending) { - return Object.assign(f, { active: false }); - } - - return f; - }), + openFiles: state.openFiles.map(f => Object.assign(f, { active: false })), }); if (pendingTab) { @@ -121,11 +115,22 @@ export default { }); } else { Object.assign(state, { - openFiles: state.openFiles.concat({ - ...file, - active: true, - pending: true, - key: `pending-${file.key}`, + entries: Object.assign(state.entries, { + [file.path]: Object.assign(state.entries[file.path], { + opened: false, + }), + }), + openFiles: state.openFiles.map(f => { + if (f.path === file.path) { + return { + ...f, + active: true, + pending: true, + key: `pending-${f.key}`, + }; + } + + return f; }), }); } |