Fixed conflict detection on Google Drive
This commit is contained in:
parent
f214fb35a7
commit
7a4d455c18
@ -1 +1 @@
|
|||||||
CACHE MANIFEST
# v24
CACHE:
index.html
viewer.html
css/main-min.css
js/main-min.js
js/require.js
img/ajax-loader.gif
img/glyphicons-halflings.png
img/glyphicons-halflings-white.png
img/icons.png
img/stackedit-32.ico
img/stackedit-promo.png
NETWORK:
*
|
CACHE MANIFEST
# v25
CACHE:
index.html
viewer.html
css/main-min.css
js/main-min.js
js/require.js
img/ajax-loader.gif
img/glyphicons-halflings.png
img/glyphicons-halflings-white.png
img/icons.png
img/stackedit-32.ico
img/stackedit-promo.png
NETWORK:
*
|
@ -193,9 +193,11 @@ define(["jquery", "core", "dropbox-helper"], function($, core, dropboxHelper) {
|
|||||||
var localContent = localStorage[fileIndex + ".content"];
|
var localContent = localStorage[fileIndex + ".content"];
|
||||||
var localContentChanged = syncAttributes.contentCRC != core.crc32(localContent);
|
var localContentChanged = syncAttributes.contentCRC != core.crc32(localContent);
|
||||||
var file = change.stat;
|
var file = change.stat;
|
||||||
|
var remoteContentCRC = core.crc32(file.content);
|
||||||
|
var remoteContentChanged = syncAttributes.contentCRC != remoteContentCRC;
|
||||||
var fileContentChanged = localContent != file.content;
|
var fileContentChanged = localContent != file.content;
|
||||||
// Conflict detection
|
// Conflict detection
|
||||||
if (fileContentChanged === true && localContentChanged === true) {
|
if (fileContentChanged === true && localContentChanged === true && remoteContentChanged === true) {
|
||||||
core.fileManager.createFile(localTitle + " (backup)", localContent);
|
core.fileManager.createFile(localTitle + " (backup)", localContent);
|
||||||
updateFileTitles = true;
|
updateFileTitles = true;
|
||||||
core.showMessage('Conflict detected on "' + localTitle + '". A backup has been created locally.');
|
core.showMessage('Conflict detected on "' + localTitle + '". A backup has been created locally.');
|
||||||
@ -211,7 +213,7 @@ define(["jquery", "core", "dropbox-helper"], function($, core, dropboxHelper) {
|
|||||||
}
|
}
|
||||||
// Update syncAttributes
|
// Update syncAttributes
|
||||||
syncAttributes.version = file.versionTag;
|
syncAttributes.version = file.versionTag;
|
||||||
syncAttributes.contentCRC = core.crc32(file.content);
|
syncAttributes.contentCRC = remoteContentCRC;
|
||||||
localStorage[syncIndex] = JSON.stringify(syncAttributes);
|
localStorage[syncIndex] = JSON.stringify(syncAttributes);
|
||||||
});
|
});
|
||||||
if(updateFileTitles) {
|
if(updateFileTitles) {
|
||||||
|
@ -185,11 +185,15 @@ define(["jquery", "core", "google-helper", "underscore"], function($, core, goog
|
|||||||
var localContent = localStorage[fileIndex + ".content"];
|
var localContent = localStorage[fileIndex + ".content"];
|
||||||
var localContentChanged = syncAttributes.contentCRC != core.crc32(localContent);
|
var localContentChanged = syncAttributes.contentCRC != core.crc32(localContent);
|
||||||
var file = change.file;
|
var file = change.file;
|
||||||
var fileTitleChanged = localTitle != file.title;
|
var remoteTitleCRC = core.crc32(file.title);
|
||||||
|
var remoteTitleChanged = syncAttributes.titleCRC != remoteTitleCRC;
|
||||||
|
var fileTitleChanged = localTitle != file.title;
|
||||||
|
var remoteContentCRC = core.crc32(file.content);
|
||||||
|
var remoteContentChanged = syncAttributes.contentCRC != remoteContentCRC;
|
||||||
var fileContentChanged = localContent != file.content;
|
var fileContentChanged = localContent != file.content;
|
||||||
// Conflict detection
|
// Conflict detection
|
||||||
if ((fileTitleChanged === true && localTitleChanged === true)
|
if ((fileTitleChanged === true && localTitleChanged === true && remoteTitleChanged === true)
|
||||||
|| (fileContentChanged === true && localContentChanged === true)) {
|
|| (fileContentChanged === true && localContentChanged === true && remoteContentChanged === true)) {
|
||||||
core.fileManager.createFile(localTitle + " (backup)", localContent);
|
core.fileManager.createFile(localTitle + " (backup)", localContent);
|
||||||
updateFileTitles = true;
|
updateFileTitles = true;
|
||||||
core.showMessage('Conflict detected on "' + localTitle + '". A backup has been created locally.');
|
core.showMessage('Conflict detected on "' + localTitle + '". A backup has been created locally.');
|
||||||
@ -211,8 +215,8 @@ define(["jquery", "core", "google-helper", "underscore"], function($, core, goog
|
|||||||
}
|
}
|
||||||
// Update syncAttributes
|
// Update syncAttributes
|
||||||
syncAttributes.etag = file.etag;
|
syncAttributes.etag = file.etag;
|
||||||
syncAttributes.contentCRC = core.crc32(file.content);
|
syncAttributes.contentCRC = remoteContentCRC;
|
||||||
syncAttributes.titleCRC = core.crc32(file.title);
|
syncAttributes.titleCRC = remoteTitleCRC;
|
||||||
localStorage[syncIndex] = JSON.stringify(syncAttributes);
|
localStorage[syncIndex] = JSON.stringify(syncAttributes);
|
||||||
});
|
});
|
||||||
if(updateFileTitles) {
|
if(updateFileTitles) {
|
||||||
|
258
js/main-min.js
vendored
258
js/main-min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user