Merge branch 'staging' into newdrive

This commit is contained in:
yflory
2017-09-25 17:35:06 +02:00
19 changed files with 105 additions and 92 deletions

View File

@@ -111,12 +111,14 @@ define([
var newFo = proxyData.fo;
var oldRecentPads = parsed.drive[newFo.FILES_DATA];
var newRecentPads = proxy.drive[newFo.FILES_DATA];
var newFiles = newFo.getFiles([newFo.FILES_DATA]);
var oldFiles = oldFo.getFiles([newFo.FILES_DATA]);
var newHrefs = Object.keys(newRecentPads).map(function (id) {
return newRecentPads[id].href;
});
oldFiles.forEach(function (id) {
var href = oldRecentPads[id].href;
// Do not migrate a pad if we already have it, it would create a duplicate in the drive
if (newFiles.indexOf(id) !== -1) { return; }
if (newHrefs.indexOf(href) !== -1) { return; }
// If we have a stronger version, do not add the current href
if (Cryptpad.findStronger(href, newRecentPads)) { return; }
// If we have a weaker version, replace the href by the new one