Commit 7c4c8878 authored by Romain Courteaud's avatar Romain Courteaud

ReplicateStorage: remove one useless signature_storage.allAttachments call

parent 4f466b0c
...@@ -472,46 +472,32 @@ ...@@ -472,46 +472,32 @@
function pushDocumentAttachment(context, function pushDocumentAttachment(context,
skip_attachment_dict, id, source, skip_attachment_dict, id, source,
destination, destination, signature_allAttachments,
options) { options) {
var queue = new RSVP.Queue(), var local_dict = {},
local_dict = {},
signature_dict = {}; signature_dict = {};
return queue return source.allAttachments(id)
.push(function () {
return RSVP.all([
source.allAttachments(id)
.push(undefined, function (error) { .push(undefined, function (error) {
if ((error instanceof jIO.util.jIOError) && if ((error instanceof jIO.util.jIOError) &&
(error.status_code === 404)) { (error.status_code === 404)) {
return {}; return {};
} }
throw error; throw error;
}),
context._signature_sub_storage.allAttachments(id)
.push(undefined, function (error) {
if ((error instanceof jIO.util.jIOError) &&
(error.status_code === 404)) {
return {};
}
throw error;
})
]);
}) })
.push(function (result_list) { .push(function (source_allAttachments) {
var is_modification, var is_modification,
is_creation, is_creation,
key, key,
argument_list = []; argument_list = [];
for (key in result_list[0]) { for (key in source_allAttachments) {
if (result_list[0].hasOwnProperty(key)) { if (source_allAttachments.hasOwnProperty(key)) {
if (!skip_attachment_dict.hasOwnProperty(key)) { if (!skip_attachment_dict.hasOwnProperty(key)) {
local_dict[key] = null; local_dict[key] = null;
} }
} }
} }
for (key in result_list[1]) { for (key in signature_allAttachments) {
if (result_list[1].hasOwnProperty(key)) { if (signature_allAttachments.hasOwnProperty(key)) {
if (!skip_attachment_dict.hasOwnProperty(key)) { if (!skip_attachment_dict.hasOwnProperty(key)) {
signature_dict[key] = null; signature_dict[key] = null;
} }
...@@ -576,6 +562,24 @@ ...@@ -576,6 +562,24 @@
var skip_attachment_dict = {}; var skip_attachment_dict = {};
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
if (context._check_local_attachment_modification ||
context._check_local_attachment_creation ||
context._check_local_attachment_deletion ||
context._check_remote_attachment_modification ||
context._check_remote_attachment_creation ||
context._check_remote_attachment_deletion) {
return context._signature_sub_storage.allAttachments(id);
}
return {};
})
.push(undefined, function (error) {
if ((error instanceof jIO.util.jIOError) &&
(error.status_code === 404)) {
return {};
}
throw error;
})
.push(function (signature_allAttachments) {
if (context._check_local_attachment_modification || if (context._check_local_attachment_modification ||
context._check_local_attachment_creation || context._check_local_attachment_creation ||
context._check_local_attachment_deletion) { context._check_local_attachment_deletion) {
...@@ -585,6 +589,7 @@ ...@@ -585,6 +589,7 @@
id, id,
context._local_sub_storage, context._local_sub_storage,
context._remote_sub_storage, context._remote_sub_storage,
signature_allAttachments,
{ {
conflict_force: (context._conflict_handling === conflict_force: (context._conflict_handling ===
CONFLICT_KEEP_LOCAL), CONFLICT_KEEP_LOCAL),
...@@ -597,10 +602,14 @@ ...@@ -597,10 +602,14 @@
check_creation: context._check_local_attachment_creation, check_creation: context._check_local_attachment_creation,
check_deletion: context._check_local_attachment_deletion check_deletion: context._check_local_attachment_deletion
} }
); )
.push(function () {
return signature_allAttachments;
});
} }
return signature_allAttachments;
}) })
.push(function () { .push(function (signature_allAttachments) {
if (context._check_remote_attachment_modification || if (context._check_remote_attachment_modification ||
context._check_remote_attachment_creation || context._check_remote_attachment_creation ||
context._check_remote_attachment_deletion) { context._check_remote_attachment_deletion) {
...@@ -610,6 +619,7 @@ ...@@ -610,6 +619,7 @@
id, id,
context._remote_sub_storage, context._remote_sub_storage,
context._local_sub_storage, context._local_sub_storage,
signature_allAttachments,
{ {
use_revert_post: context._use_remote_post, use_revert_post: context._use_remote_post,
conflict_force: (context._conflict_handling === conflict_force: (context._conflict_handling ===
......
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