diff --git a/src/node/utils/ImportEtherpad.js b/src/node/utils/ImportEtherpad.js index 8daeb5363..1574a3a9d 100644 --- a/src/node/utils/ImportEtherpad.js +++ b/src/node/utils/ImportEtherpad.js @@ -24,12 +24,25 @@ exports.setPadRaw = function(padId, records, callback){ async.eachSeries(Object.keys(records), function(key, cb){ var value = records[key] - // we know its an author + // Author data if(value.padIDs){ // rewrite author pad ids value.padIDs[padId] = 1; var newKey = key; + // Does this author already exist? + db.get(key, function(err, author){ + if(author){ + // Yes, add the padID to the author.. + author.padIDs.push(padId); + value = author; + }else{ + // No, create a new array with the author info in + value.padIDs = [padId]; + } + }); + + // Not author data, probably pad data }else{ // we can split it to look to see if its pad data var oldPadId = key.split(":");