Commit 807973ae authored by Tristan Cavelier's avatar Tristan Cavelier

Fix bug: conflict manager get document list does not retreive deleted files anymore

parent feb38041
/*! JIO Storage - v0.1.0 - 2012-08-03 /*! JIO Storage - v0.1.0 - 2012-08-06
* Copyright (c) 2012 Nexedi; Licensed */ * Copyright (c) 2012 Nexedi; Licensed */
(function(LocalOrCookieStorage, $, Base64, sjcl, hex_sha256, Jio) { (function(LocalOrCookieStorage, $, Base64, sjcl, hex_sha256, Jio) {
...@@ -1816,10 +1816,15 @@ var newConflictManagerStorage = function ( spec, my ) { ...@@ -1816,10 +1816,15 @@ var newConflictManagerStorage = function ( spec, my ) {
command, path+'.metadata', command, path+'.metadata',
function (data) { function (data) {
data = JSON.parse (data.content); data = JSON.parse (data.content);
am.call( var revision = priv.chooseARevision(data);
o,'loadFile', if (!data[revision].deleted) {
[path,priv.chooseARevision(data),data] am.call(
); o,'loadFile',
[path,revision,data]
);
} else {
am.call(o,'success');
}
},function (error) { },function (error) {
am.call(o,'error',[error]); am.call(o,'error',[error]);
} }
...@@ -1895,9 +1900,15 @@ var newConflictManagerStorage = function ( spec, my ) { ...@@ -1895,9 +1900,15 @@ var newConflictManagerStorage = function ( spec, my ) {
priv.getDistantMetadata ( priv.getDistantMetadata (
command,metadata_file_path, command,metadata_file_path,
function (result) { function (result) {
metadata_file_content = JSON.parse (result.content);
if (previous_revision === 'last') {
previous_revision =
priv.chooseARevision (metadata_file_content);
previous_revision_file_path = command.getPath() + '.' +
previous_revision;
}
var previous_revision_number = var previous_revision_number =
parseInt(previous_revision.split('-')[0],10); parseInt(previous_revision.split('-')[0],10);
metadata_file_content = JSON.parse (result.content);
// set current revision // set current revision
current_revision = (previous_revision_number + 1) + '-' + current_revision = (previous_revision_number + 1) + '-' +
hex_sha256 ('' + previous_revision + hex_sha256 ('' + previous_revision +
...@@ -1973,10 +1984,10 @@ var newConflictManagerStorage = function ( spec, my ) { ...@@ -1973,10 +1984,10 @@ var newConflictManagerStorage = function ( spec, my ) {
empty_fun,empty_fun); empty_fun,empty_fun);
} }
}; };
o.success = function (){ o.success = function (revision){
am.neverCall(o,'error'); am.neverCall(o,'error');
am.neverCall(o,'success'); am.neverCall(o,'success');
that.success({revision:current_revision}); that.success({revision:revision || current_revision});
}; };
o.error = function (error){ o.error = function (error){
var gooderror = error || failerror || var gooderror = error || failerror ||
......
This diff is collapsed.
...@@ -583,10 +583,15 @@ var newConflictManagerStorage = function ( spec, my ) { ...@@ -583,10 +583,15 @@ var newConflictManagerStorage = function ( spec, my ) {
command, path+'.metadata', command, path+'.metadata',
function (data) { function (data) {
data = JSON.parse (data.content); data = JSON.parse (data.content);
am.call( var revision = priv.chooseARevision(data);
o,'loadFile', if (!data[revision].deleted) {
[path,priv.chooseARevision(data),data] am.call(
); o,'loadFile',
[path,revision,data]
);
} else {
am.call(o,'success');
}
},function (error) { },function (error) {
am.call(o,'error',[error]); am.call(o,'error',[error]);
} }
...@@ -662,9 +667,15 @@ var newConflictManagerStorage = function ( spec, my ) { ...@@ -662,9 +667,15 @@ var newConflictManagerStorage = function ( spec, my ) {
priv.getDistantMetadata ( priv.getDistantMetadata (
command,metadata_file_path, command,metadata_file_path,
function (result) { function (result) {
metadata_file_content = JSON.parse (result.content);
if (previous_revision === 'last') {
previous_revision =
priv.chooseARevision (metadata_file_content);
previous_revision_file_path = command.getPath() + '.' +
previous_revision;
}
var previous_revision_number = var previous_revision_number =
parseInt(previous_revision.split('-')[0],10); parseInt(previous_revision.split('-')[0],10);
metadata_file_content = JSON.parse (result.content);
// set current revision // set current revision
current_revision = (previous_revision_number + 1) + '-' + current_revision = (previous_revision_number + 1) + '-' +
hex_sha256 ('' + previous_revision + hex_sha256 ('' + previous_revision +
...@@ -740,10 +751,10 @@ var newConflictManagerStorage = function ( spec, my ) { ...@@ -740,10 +751,10 @@ var newConflictManagerStorage = function ( spec, my ) {
empty_fun,empty_fun); empty_fun,empty_fun);
} }
}; };
o.success = function (){ o.success = function (revision){
am.neverCall(o,'error'); am.neverCall(o,'error');
am.neverCall(o,'success'); am.neverCall(o,'success');
that.success({revision:current_revision}); that.success({revision:revision || current_revision});
}; };
o.error = function (error){ o.error = function (error){
var gooderror = error || failerror || var gooderror = error || failerror ||
......
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