Commit 25b9ca5f authored by Tristan Cavelier's avatar Tristan Cavelier

Improve compatibility with conflict manager storage

It returns now an object containing the new revision instead of the new revision only
parent 96d1e753
...@@ -559,8 +559,8 @@ ...@@ -559,8 +559,8 @@
current_content,{ current_content,{
previous_revision: priv.data_object.currentRevision || '0', previous_revision: priv.data_object.currentRevision || '0',
success: function (result) { success: function (result) {
if (result) { if (result && result.revision) {
priv.data_object.currentRevision = result; priv.data_object.currentRevision = result.revision;
} }
priv.loading_object.end_save(); priv.loading_object.end_save();
that.getList(); that.getList();
...@@ -595,7 +595,7 @@ ...@@ -595,7 +595,7 @@
basename+'.'+current_editor.ext,{ basename+'.'+current_editor.ext,{
max_retry:3, max_retry:3,
success: function (result) { success: function (result) {
if (result.revision) { if (result && result.revision) {
priv.data_object.currentRevision = result.revision; priv.data_object.currentRevision = result.revision;
if (result.conflict_object) { if (result.conflict_object) {
priv.onConflict(result.conflict_object); priv.onConflict(result.conflict_object);
...@@ -705,8 +705,8 @@ ...@@ -705,8 +705,8 @@
conflict_object.solveConflict( conflict_object.solveConflict(
data,{ data,{
success: function (result) { success: function (result) {
if (result) { if (result && result.revision) {
priv.data_object.currentRevision = result; priv.data_object.currentRevision = result.revision;
} }
priv.loading_object.end_save(); priv.loading_object.end_save();
that.getList(); that.getList();
......
/*! JIO Storage - v0.1.0 - 2012-08-02 /*! JIO Storage - v0.1.0 - 2012-08-03
* Copyright (c) 2012 Nexedi; Licensed */ * Copyright (c) 2012 Nexedi; Licensed */
(function(LocalOrCookieStorage, $, Base64, sjcl, hex_sha256, Jio) { (function(LocalOrCookieStorage, $, Base64, sjcl, hex_sha256, Jio) {
...@@ -1441,7 +1441,7 @@ var newConflictManagerStorage = function ( spec, my ) { ...@@ -1441,7 +1441,7 @@ var newConflictManagerStorage = function ( spec, my ) {
o.success = function (){ o.success = function (){
am.neverCall(o,'error'); am.neverCall(o,'error');
am.neverCall(o,'success'); am.neverCall(o,'success');
if (option.success) {option.success(current_revision);} if (option.success) {option.success({revision:current_revision});}
}; };
o.error = function (error){ o.error = function (error){
var gooderror = error || failerror || {}; var gooderror = error || failerror || {};
...@@ -1651,7 +1651,7 @@ var newConflictManagerStorage = function ( spec, my ) { ...@@ -1651,7 +1651,7 @@ var newConflictManagerStorage = function ( spec, my ) {
o.success = function (){ o.success = function (){
am.neverCall(o,'error'); am.neverCall(o,'error');
am.neverCall(o,'success'); am.neverCall(o,'success');
that.success(current_revision); that.success({revision:current_revision});
}; };
o.error = function (error){ o.error = function (error){
var gooderror = error || failerror || var gooderror = error || failerror ||
...@@ -1976,7 +1976,7 @@ var newConflictManagerStorage = function ( spec, my ) { ...@@ -1976,7 +1976,7 @@ var newConflictManagerStorage = function ( spec, my ) {
o.success = function (){ o.success = function (){
am.neverCall(o,'error'); am.neverCall(o,'error');
am.neverCall(o,'success'); am.neverCall(o,'success');
that.success(current_revision); that.success({revision:current_revision});
}; };
o.error = function (error){ o.error = function (error){
var gooderror = error || failerror || var gooderror = error || failerror ||
......
This diff is collapsed.
...@@ -208,7 +208,7 @@ var newConflictManagerStorage = function ( spec, my ) { ...@@ -208,7 +208,7 @@ var newConflictManagerStorage = function ( spec, my ) {
o.success = function (){ o.success = function (){
am.neverCall(o,'error'); am.neverCall(o,'error');
am.neverCall(o,'success'); am.neverCall(o,'success');
if (option.success) {option.success(current_revision);} if (option.success) {option.success({revision:current_revision});}
}; };
o.error = function (error){ o.error = function (error){
var gooderror = error || failerror || {}; var gooderror = error || failerror || {};
...@@ -418,7 +418,7 @@ var newConflictManagerStorage = function ( spec, my ) { ...@@ -418,7 +418,7 @@ var newConflictManagerStorage = function ( spec, my ) {
o.success = function (){ o.success = function (){
am.neverCall(o,'error'); am.neverCall(o,'error');
am.neverCall(o,'success'); am.neverCall(o,'success');
that.success(current_revision); that.success({revision:current_revision});
}; };
o.error = function (error){ o.error = function (error){
var gooderror = error || failerror || var gooderror = error || failerror ||
...@@ -743,7 +743,7 @@ var newConflictManagerStorage = function ( spec, my ) { ...@@ -743,7 +743,7 @@ var newConflictManagerStorage = function ( spec, my ) {
o.success = function (){ o.success = function (){
am.neverCall(o,'error'); am.neverCall(o,'error');
am.neverCall(o,'success'); am.neverCall(o,'success');
that.success(current_revision); that.success({revision:current_revision});
}; };
o.error = function (error){ o.error = function (error){
var gooderror = error || failerror || var gooderror = error || failerror ||
......
...@@ -1321,9 +1321,9 @@ test ('Simple methods', function () { ...@@ -1321,9 +1321,9 @@ test ('Simple methods', function () {
o.spy('status','done','saving "file.doc".'); o.spy('status','done','saving "file.doc".');
o.jio.saveDocument('file.doc','content1',{ o.jio.saveDocument('file.doc','content1',{
previous_revision: '0', previous_revision: '0',
success:function (revision) { success:function (result) {
o.new_rev = revision; o.new_rev = result.revision;
o.f (revision); o.f (result);
}, },
error:o.f error:o.f
}); });
...@@ -1452,7 +1452,7 @@ test ('Revision Conflict', function() { ...@@ -1452,7 +1452,7 @@ test ('Revision Conflict', function() {
previous_revision:'0', previous_revision:'0',
error:o.f, error:o.f,
success:function(value){ success:function(value){
o.rev.first = value; o.rev.first = value.revision;
o.f(value); o.f(value);
} }
}); });
...@@ -1467,7 +1467,7 @@ test ('Revision Conflict', function() { ...@@ -1467,7 +1467,7 @@ test ('Revision Conflict', function() {
error:o.f, error:o.f,
success:function(v) { success:function(v) {
o.f(v); o.f(v);
o.rev.second = v; o.rev.second = v.revision;
} }
}); });
o.tick(); o.tick();
...@@ -1512,7 +1512,7 @@ test ('Revision Conflict', function() { ...@@ -1512,7 +1512,7 @@ test ('Revision Conflict', function() {
error:o.f, error:o.f,
success:function (r) { success:function (r) {
o.f(r); o.f(r);
o.rev.forth = r; o.rev.forth = r.revision;
} }
}); });
o.tick(); o.tick();
...@@ -1575,7 +1575,7 @@ test ('Conflict in a conflict solving', function () { ...@@ -1575,7 +1575,7 @@ test ('Conflict in a conflict solving', function () {
previous_revision:'0', previous_revision:'0',
error:o.f, error:o.f,
success:function(value){ success:function(value){
o.rev.first = value; o.rev.first = value.revision;
o.f(value); o.f(value);
} }
}); });
...@@ -1632,7 +1632,7 @@ test ('Conflict in a conflict solving', function () { ...@@ -1632,7 +1632,7 @@ test ('Conflict in a conflict solving', function () {
error:o.f, error:o.f,
success:function (v) { success:function (v) {
o.f(v); o.f(v);
o.rev.fith = v; o.rev.fith = v.revision;
} }
}); });
o.tick(); o.tick();
...@@ -1694,7 +1694,7 @@ test ('Remove revision conflict', function () { ...@@ -1694,7 +1694,7 @@ test ('Remove revision conflict', function () {
previous_revision:'0', previous_revision:'0',
error:o.f, error:o.f,
success:function(value){ success:function(value){
o.rev.first = value; o.rev.first = value.revision;
o.f(value); o.f(value);
} }
}); });
...@@ -1748,7 +1748,7 @@ test ('Remove revision conflict', function () { ...@@ -1748,7 +1748,7 @@ test ('Remove revision conflict', function () {
error:o.f, error:o.f,
success:function (v) { success:function (v) {
o.f(v); o.f(v);
o.rev.forth = v; o.rev.forth = v.revision;
} }
}); });
o.tick(); o.tick();
......
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