From 93fcab046181b8224649dbc4b0184c2c29f94e5b Mon Sep 17 00:00:00 2001 From: s1341 Date: Sun, 17 Nov 2013 21:01:02 +0200 Subject: [PATCH] change parameter names --- src/node/db/API.js | 8 ++++---- src/node/db/Pad.js | 28 ++++++++++++++-------------- src/node/handler/APIHandler.js | 4 ++-- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/node/db/API.js b/src/node/db/API.js index 39b37959..e18add8e 100644 --- a/src/node/db/API.js +++ b/src/node/db/API.js @@ -553,20 +553,20 @@ exports.deletePad = function(padID, callback) } /** -copyPad(padID, newID) copies a pad +copyPad(sourceID, destinationID) copies a pad Example returns: {code: 0, message:"ok", data: null} {code: 1, message:"padID does not exist", data: null} */ -exports.copyPad = function(padID, newID, callback) +exports.copyPad = function(sourceID, destinationID, callback) { - getPadSafe(padID, true, function(err, pad) + getPadSafe(sourceID, true, function(err, pad) { if(ERR(err, callback)) return; - pad.copy(newID, callback); + pad.copy(destinationID, callback); }); } diff --git a/src/node/db/Pad.js b/src/node/db/Pad.js index 7c2f63aa..fc16c2ee 100644 --- a/src/node/db/Pad.js +++ b/src/node/db/Pad.js @@ -406,13 +406,13 @@ Pad.prototype.init = function init(text, callback) { }); }; -Pad.prototype.copy = function copy(newID, callback) { - var padID = this.id; +Pad.prototype.copy = function copy(destinationID, callback) { + var sourceID = this.id; var _this = this; //kick everyone from this pad // TODO: this presents a message on the client saying that the pad was 'deleted'. Fix this? - padMessageHandler.kickSessionsFromPad(padID); + padMessageHandler.kickSessionsFromPad(sourceID); // flush the source pad: _this.saveToDatabase(); @@ -421,9 +421,9 @@ Pad.prototype.copy = function copy(newID, callback) { // if it's a group pad, let's make sure the group exists. function(callback) { - if (newID.indexOf("$") != -1) + if (destinationID.indexOf("$") != -1) { - groupManager.doesGroupExist(newID.split("$")[0], function (err, exists) + groupManager.doesGroupExist(destinationID.split("$")[0], function (err, exists) { if(ERR(err, callback)) return; @@ -444,7 +444,7 @@ Pad.prototype.copy = function copy(newID, callback) { // if the pad exists, we should abort. function(callback) { - padManager.doesPadExists(newID, function (err, exists) + padManager.doesPadExists(destinationID, function (err, exists) { if(ERR(err, callback)) return; @@ -455,8 +455,8 @@ Pad.prototype.copy = function copy(newID, callback) { //everything is fine, continue else { - db.get("pad:"+padID, function(err, pad) { - db.set("pad:"+newID, pad); + db.get("pad:"+sourceID, function(err, pad) { + db.set("pad:"+destinationID, pad); callback(); }); } @@ -473,8 +473,8 @@ Pad.prototype.copy = function copy(newID, callback) { for(var i=0;i<=chatHead;i++) { - db.get("pad:"+padID+":chat:"+i, function (err, chat) { - db.set("pad:"+newID+":chat:"+i, chat); + db.get("pad:"+sourceID+":chat:"+i, function (err, chat) { + db.set("pad:"+destinationID+":chat:"+i, chat); }); } @@ -487,9 +487,9 @@ Pad.prototype.copy = function copy(newID, callback) { for(var i=0;i<=revHead;i++) { - db.get("pad:"+padID+":revs:"+i, function (err, rev) { + db.get("pad:"+sourceID+":revs:"+i, function (err, rev) { if (ERR(err, callback)) return; - db.set("pad:"+newID+":revs:"+i, rev); + db.set("pad:"+destinationID+":revs:"+i, rev); }); } @@ -502,7 +502,7 @@ Pad.prototype.copy = function copy(newID, callback) { authorIDs.forEach(function (authorID) { - authorManager.addPad(authorID, newID); + authorManager.addPad(authorID, destinationID); }); callback(); @@ -514,7 +514,7 @@ Pad.prototype.copy = function copy(newID, callback) { ], function(err) { if(ERR(err, callback)) return; - callback(null, {padID: newID}); + callback(null, {padID: destinationID}); }); }; diff --git a/src/node/handler/APIHandler.js b/src/node/handler/APIHandler.js index 7df0864d..72561ea8 100644 --- a/src/node/handler/APIHandler.js +++ b/src/node/handler/APIHandler.js @@ -240,8 +240,8 @@ var version = , "getRevisionChangeset" : ["padID", "rev"] , "getLastEdited" : ["padID"] , "deletePad" : ["padID"] - , "copyPad" : ["padID", "newID"] - , "movePad" : ["padID", "newID"] + , "copyPad" : ["sourceID", "destinationID"] + , "movePad" : ["sourceID", "destinationID"] , "getReadOnlyID" : ["padID"] , "setPublicStatus" : ["padID", "publicStatus"] , "getPublicStatus" : ["padID"]