Always show dialog when collab reports that the doc has changed. Don't do a double check as sometimes that will cause the dialog to not show

pull/333/head
Tim Robinson 2016-06-06 18:28:18 +00:00
rodzic 15d8db963a
commit f86b9037e1
2 zmienionych plików z 24 dodań i 11 usunięć

Wyświetl plik

@ -71,7 +71,7 @@
"c9.ide.language.javascript.infer": "#b9c2e4bdb8",
"c9.ide.language.jsonalyzer": "#72954f8da1",
"c9.ide.language.codeintel": "#4e0a272229",
"c9.ide.collab": "#7712a59456",
"c9.ide.collab": "#0b139735fd",
"c9.ide.local": "#9169fec157",
"c9.ide.find": "#a2dfc3e306",
"c9.ide.find.infiles": "#488db22ee1",

Wyświetl plik

@ -20,6 +20,12 @@ define(function(require, exports, module) {
var collab = imports.collab;
var collabEnabled = options.collab;
var comparisonType = {
TIMESTAMP_AND_CONTENTS: "TIMESTAMP_AND_CONTENTS",
CONTENTS: "CONTENTS",
NONE: "NONE"
};
/***** Initialization *****/
@ -88,14 +94,14 @@ define(function(require, exports, module) {
}
if (tab.classList.contains("conflict")) {
addChangedTab(tab, true);
addChangedTab(tab, comparisonType.TIMESTAMP_AND_CONTENTS);
}
});
tabManager.on("open", function(e) {
initializeDocument(e.tab.document);
if (e.tab.classList.contains("conflict")) {
addChangedTab(e.tab, true);
addChangedTab(e.tab, comparisonType.TIMESTAMP_AND_CONTENTS);
}
}, plugin);
@ -137,14 +143,14 @@ define(function(require, exports, module) {
return false;
}
addChangedTab(tab, e.type === "change");
addChangedTab(tab, comparisonType.TIMESTAMP_AND_CONTENTS);
}
});
collab.on("change", function (e) {
var tab = tabManager.findTab(e.path);
if (tab) {
addChangedTab(tab, e.type === "change");
addChangedTab(tab, comparisonType.NONE);
}
});
@ -157,7 +163,7 @@ define(function(require, exports, module) {
/***** Methods *****/
function addChangedTab(tab, isSameFile) {
function addChangedTab(tab, doubleCheckComparisonType) {
// If we already have a dialog open, just update it, but mark the value dirty
if (changedPaths[tab.path]) {
if (changedPaths[tab.path].data)
@ -179,7 +185,7 @@ define(function(require, exports, module) {
if (tabManager.focussedTab
&& tabManager.focussedTab.editorType == "terminal") {
tabManager.once("focus", function(){
addChangedTab(tab, false);
addChangedTab(tab, comparisonType.CONTENTS);
});
return;
}
@ -194,10 +200,17 @@ define(function(require, exports, module) {
var doc = tab.document;
var path = tab.path;
if (isSameFile)
checkByStatOrContents();
else
checkByContents();
switch (doubleCheckComparisonType) {
case comparisonType.TIMESTAMP_AND_CONTENTS:
checkByStatOrContents();
break;
case comparisonType.CONTENTS:
checkByContents();
break;
case comparisonType.NONE:
dialog();
break;
}
function dialog(data) {
if (!changedPaths[path])