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 {
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');
}
});
},
},
......
......@@ -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) => {
......
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