more author logic

pull/2418/head
John McLear 2014-12-29 23:08:17 +01:00
parent ec2b844f94
commit 1e0de620be
1 changed files with 10 additions and 1 deletions

View File

@ -23,10 +23,19 @@ exports.setPadRaw = function(padId, records, callback){
async.eachSeries(Object.keys(records), function(key, cb){
var value = records[key]
// rewrite padId
var oldPadId = key.split(":");
oldPadId[1] = padId;
var newKey = oldPadId.join(":"); // create the new key
if(oldPadId[0] === "pad"){
var newKey = oldPadId.join(":"); // create the new key
}
// Add the author to this new pad
if(oldPadId[0] === "globalAuthor"){
value.padIDs[padId] = 1 ;
var newKey = value;
}
// Write the value to the server
db.set(newKey, value);