Commit 8c4ad738 authored by Phil Hughes's avatar Phil Hughes

stops opening a pending tab if current tab is in review mode already

parent 53707c83
...@@ -23,8 +23,10 @@ export default { ...@@ -23,8 +23,10 @@ export default {
methods: { methods: {
...mapActions(['discardFileChanges', 'updateViewer', 'openPendingTab']), ...mapActions(['discardFileChanges', 'updateViewer', 'openPendingTab']),
openFileInEditor(file) { openFileInEditor(file) {
return this.updateViewer('diff').then(() => { return this.openPendingTab(file).then(changeViewer => {
this.openPendingTab(file); if (changeViewer) {
this.updateViewer('diff');
}
}); });
}, },
}, },
......
...@@ -138,12 +138,18 @@ export const discardFileChanges = ({ state, commit }, path) => { ...@@ -138,12 +138,18 @@ export const discardFileChanges = ({ state, commit }, path) => {
eventHub.$emit(`editor.update.model.content.${file.path}`, file.raw); 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); commit(types.ADD_PENDING_TAB, file);
dispatch('scrollToTab'); dispatch('scrollToTab');
router.push(`/project/${file.projectId}/tree/${state.currentBranchId}/`); router.push(`/project/${file.projectId}/tree/${state.currentBranchId}/`);
return true;
}; };
export const removePendingTab = ({ commit }, file) => { export const removePendingTab = ({ commit }, file) => {
......
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