diff options
author | Phil Hughes <me@iamphill.com> | 2018-03-27 14:28:07 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-03-28 14:08:34 +0100 |
commit | 8c4ad7385dab6dd3b50fbcb51605bc8abe81126a (patch) | |
tree | 3b3e968f4d442b2e932bab46f8dfdeb7bd6aefe6 /app/assets | |
parent | 53707c83a587793b41bcf52c6b998549eeed8857 (diff) | |
download | gitlab-ce-8c4ad7385dab6dd3b50fbcb51605bc8abe81126a.tar.gz |
stops opening a pending tab if current tab is in review mode already
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/ide/components/commit_sidebar/list_item.vue | 6 | ||||
-rw-r--r-- | app/assets/javascripts/ide/stores/actions/file.js | 8 |
2 files changed, 11 insertions, 3 deletions
diff --git a/app/assets/javascripts/ide/components/commit_sidebar/list_item.vue b/app/assets/javascripts/ide/components/commit_sidebar/list_item.vue index 421be7fb3cb..9affc14a57c 100644 --- a/app/assets/javascripts/ide/components/commit_sidebar/list_item.vue +++ b/app/assets/javascripts/ide/components/commit_sidebar/list_item.vue @@ -23,8 +23,10 @@ export default { methods: { ...mapActions(['discardFileChanges', 'updateViewer', 'openPendingTab']), openFileInEditor(file) { - return this.updateViewer('diff').then(() => { - this.openPendingTab(file); + return this.openPendingTab(file).then(changeViewer => { + if (changeViewer) { + this.updateViewer('diff'); + } }); }, }, diff --git a/app/assets/javascripts/ide/stores/actions/file.js b/app/assets/javascripts/ide/stores/actions/file.js index 53d80538228..2847fceaf4e 100644 --- a/app/assets/javascripts/ide/stores/actions/file.js +++ b/app/assets/javascripts/ide/stores/actions/file.js @@ -138,12 +138,18 @@ export const discardFileChanges = ({ state, commit }, path) => { eventHub.$emit(`editor.update.model.content.${file.path}`, file.raw); }; -export const openPendingTab = ({ commit, dispatch, state }, file) => { +export const openPendingTab = ({ commit, getters, dispatch, state }, file) => { + if (getters.activeFile && getters.activeFile.path === file.path && state.viewer === 'diff') { + return false; + } + commit(types.ADD_PENDING_TAB, file); dispatch('scrollToTab'); router.push(`/project/${file.projectId}/tree/${state.currentBranchId}/`); + + return true; }; export const removePendingTab = ({ commit }, file) => { |