Remove duplicates when migrating anon drive into user drive

pull/1/head
yflory 6 years ago
parent 6aa617e41e
commit 0d996b8ed4

@ -65,7 +65,9 @@ define([
if (!proxy.FS_hashes || !Array.isArray(proxy.FS_hashes)) { if (!proxy.FS_hashes || !Array.isArray(proxy.FS_hashes)) {
proxy.FS_hashes = []; proxy.FS_hashes = [];
} }
proxy.FS_hashes.push(fsHash); if (proxy.FS_hashes.indexOf(fsHash) === -1) {
proxy.FS_hashes.push(fsHash);
}
if (typeof(cb) === "function") { if (typeof(cb) === "function") {
Realtime.whenRealtimeSyncs(proxyData.realtime, cb); Realtime.whenRealtimeSyncs(proxyData.realtime, cb);
} }

@ -176,6 +176,16 @@ define([
if (version < 7) { if (version < 7) {
addRoHref(); addRoHref();
} }
}).nThen(function () {
// Migration 8: remove duplicate entries in proxy.FS_hashes (list of migrated anon drives)
var fixDuplicate = function () {
userObject.FS_hashes = Util.deduplicateString(userObject.FS_hashes);
};
if (version < 8) {
fixDuplicate();
Feedback.send('Migrate-8', true);
userObject.version = version = 8;
}
/*}).nThen(function (waitFor) { /*}).nThen(function (waitFor) {
// Test progress bar in the loading screen // Test progress bar in the loading screen
var i = 0; var i = 0;

Loading…
Cancel
Save