Commit 7cbd4552 authored by Tristan Cavelier's avatar Tristan Cavelier

Fix bug: remove several files function was not updated

parent 807973ae
...@@ -407,7 +407,6 @@ ...@@ -407,7 +407,6 @@
priv.data_object.currentSolver = realapp; priv.data_object.currentSolver = realapp;
break; break;
default: default:
priv.data_object.currentEditor = null;
break; break;
} }
priv.data_object.currentApp = realapp; priv.data_object.currentApp = realapp;
...@@ -531,7 +530,6 @@ ...@@ -531,7 +530,6 @@
priv.data_object.documentList = result; priv.data_object.documentList = result;
priv.showDocumentListInsideLeftNavBar(); priv.showDocumentListInsideLeftNavBar();
priv.loading_object.end_getlist(); priv.loading_object.end_getlist();
// TODO : announce conflicts
if (typeof callback === 'function') { if (typeof callback === 'function') {
callback(); callback();
} }
...@@ -585,7 +583,6 @@ ...@@ -585,7 +583,6 @@
that.getList(); that.getList();
if (error.conflict_object) { if (error.conflict_object) {
priv.onConflict (error.conflict_object); priv.onConflict (error.conflict_object);
// TODO : same for remove method
} }
} }
}); });
...@@ -629,8 +626,10 @@ ...@@ -629,8 +626,10 @@
* Removes a document. * Removes a document.
* @method remove * @method remove
* @param {string} name The document name. * @param {string} name The document name.
* @param {string} revision The document name.
*/ */
that.remove = function (name,revision) { that.remove = function (name,revision) {
console.log (arguments);
if (!priv.isJioSet()) { if (!priv.isJioSet()) {
console.error ('No Jio set yet.'); console.error ('No Jio set yet.');
return; return;
...@@ -638,7 +637,7 @@ ...@@ -638,7 +637,7 @@
priv.loading_object.remove(); priv.loading_object.remove();
priv.jio.removeDocument( priv.jio.removeDocument(
name,{ name,{
revision: revision, revision: revision || 'last',
success: function (result) { success: function (result) {
priv.loading_object.end_remove(); priv.loading_object.end_remove();
that.getList(); that.getList();
...@@ -651,7 +650,6 @@ ...@@ -651,7 +650,6 @@
that.getList(); that.getList();
if (error.conflict_object) { if (error.conflict_object) {
priv.onConflict (error.conflict_object); priv.onConflict (error.conflict_object);
// TODO : same for remove method
} }
} }
}); });
...@@ -668,25 +666,29 @@ ...@@ -668,25 +666,29 @@
console.error ('No Jio set yet.'); console.error ('No Jio set yet.');
return; return;
} }
var onResponse = function (result) {
cpt += 1;
if (cpt === l) {
if (typeof current_editor.update !== 'undefined') {
if (priv.data_object.currentEditor !== null &&
current_editor.path ===
priv.data_object.currentEditor.path) {
that.getList(current_editor.update);
} else {
that.getList();
}
}
}
priv.loading_object.end_remove();
};
for (i = 0, l = documentarray.length; i < l; i+= 1) { for (i = 0, l = documentarray.length; i < l; i+= 1) {
priv.loading_object.remove(); priv.loading_object.remove();
priv.jio.removeDocument( priv.jio.removeDocument(
documentarray[i], documentarray[i],{
{onResponse:function (result) { revision: 'last',
cpt += 1; success: onResponse,
if (cpt === l) { error: onResponse
if (typeof current_editor.update !== 'undefined') { });
if (priv.data_object.currentEditor !== null &&
current_editor.path ===
priv.data_object.currentEditor.path) {
that.getList(current_editor.update);
} else {
that.getList();
}
}
}
priv.loading_object.end_remove();
}});
} }
}; };
...@@ -709,9 +711,15 @@ ...@@ -709,9 +711,15 @@
// } // }
}; };
/**
* Solve the conflict
* @method solveConflict
* @param {object} conflict_data The conflict object
* @param {string} data The new content of the new revision
*/
that.solveConflict = function (conflict_object, data) { that.solveConflict = function (conflict_object, data) {
that.closeGadgetId (priv.data_object.currentSolver.gadget_id); that.closeGadgetId (priv.data_object.currentSolver.gadget_id);
priv.data_object.currentSolver = null;
priv.data_object.currentEditor.setContent(data); priv.data_object.currentEditor.setContent(data);
priv.loading_object.save(); priv.loading_object.save();
conflict_object.solveConflict( conflict_object.solveConflict(
...@@ -731,7 +739,6 @@ ...@@ -731,7 +739,6 @@
that.getList(); that.getList();
if (error.conflict_object) { if (error.conflict_object) {
priv.onConflict (error.conflict_object); priv.onConflict (error.conflict_object);
// TODO : same for remove method
} }
} }
}); });
......
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