Fix broken browser fight logging

This commit is contained in:
Caleb James DeLisle
2017-10-09 14:12:55 +03:00
parent f0eb58ee95
commit 828a685ba8

View File

@@ -162,24 +162,23 @@ define([
/* pushing back over the wire is necessary, but it can /* pushing back over the wire is necessary, but it can
result in a feedback loop, which we call a browser result in a feedback loop, which we call a browser
fight */ fight */
if (module.logFights) { // what changed?
// what changed? var op = TextPatcher.diff(newContentStrNoMeta, newContent2StrNoMeta);
var op = TextPatcher.diff(newContentStrNoMeta, newContent2StrNoMeta); // log the changes
// log the changes TextPatcher.log(newContentStrNoMeta, op);
TextPatcher.log(newContentStrNoMeta, op); var sop = JSON.stringify(TextPatcher.format(newContentStrNoMeta, op));
var sop = JSON.stringify(TextPatcher.format(newContentStrNoMeta, op));
var index = module.fights.indexOf(sop); var fights = window.CryptPad_fights = window.CryptPad_fights || [];
if (index === -1) { var index = fights.indexOf(sop);
module.fights.push(sop); if (index === -1) {
console.log("Found a new type of browser disagreement"); fights.push(sop);
console.log("You can inspect the list in your " + console.log("Found a new type of browser disagreement");
"console at `REALTIME_MODULE.fights`"); console.log("You can inspect the list in your " +
console.log(module.fights); "console at `REALTIME_MODULE.fights`");
} else { console.log(fights);
console.log("Encountered a known browser disagreement: " + } else {
"available at `REALTIME_MODULE.fights[%s]`", index); console.log("Encountered a known browser disagreement: " +
} "available at `REALTIME_MODULE.fights[%s]`", index);
} }
} }
} }