From 40a7b43799606bb582081e59d7a11ff9aa498ac2 Mon Sep 17 00:00:00 2001 From: John McLear Date: Tue, 4 Sep 2012 17:23:33 +0200 Subject: [PATCH 1/3] Update src/node/db/API.js --- src/node/db/API.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/node/db/API.js b/src/node/db/API.js index f0f1ebd44..c5caae0be 100644 --- a/src/node/db/API.js +++ b/src/node/db/API.js @@ -47,6 +47,7 @@ exports.createGroupPad = groupManager.createGroupPad; exports.createAuthor = authorManager.createAuthor; exports.createAuthorIfNotExistsFor = authorManager.createAuthorIfNotExistsFor; +exports.getAuthorName = authorManager.getAuthorName; exports.listPadsOfAuthor = authorManager.listPadsOfAuthor; exports.padUsers = padMessageHandler.padUsers; exports.padUsersCount = padMessageHandler.padUsersCount; From 21dcce22966640e4b72575a6458622a4079ee924 Mon Sep 17 00:00:00 2001 From: John McLear Date: Tue, 4 Sep 2012 17:25:19 +0200 Subject: [PATCH 2/3] Update src/node/db/AuthorManager.js --- src/node/db/AuthorManager.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/node/db/AuthorManager.js b/src/node/db/AuthorManager.js index 06b690518..6fe38abe2 100644 --- a/src/node/db/AuthorManager.js +++ b/src/node/db/AuthorManager.js @@ -141,6 +141,25 @@ exports.getAuthor = function (author, callback) db.get("globalAuthor:" + author, callback); } +/** + * Returns the Author Name of the author + * @param {String} author The id of the author + * @param {Function} callback callback(err, name) + */ + +exports.getAuthorName = function (authorID, callback) +{ + db.getSub("globalAuthor:" + author, ["name"], callback); + console.log(authorID); + db.getSub("globalAuthor:" + authorID, ["name"], function(err, authorName){ + if(ERR(err, callback)) return; + console.log(authorName); + callback(null, {authorName: authorName}); + }); +} + + + /** * Returns the color Id of the author * @param {String} author The id of the author From 7e79bf3462d157675eff61470accdbcb90af47cd Mon Sep 17 00:00:00 2001 From: John McLear Date: Tue, 4 Sep 2012 17:26:08 +0200 Subject: [PATCH 3/3] Update src/node/handler/APIHandler.js --- src/node/handler/APIHandler.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/node/handler/APIHandler.js b/src/node/handler/APIHandler.js index 4d3b38ddd..7ab72cdb5 100644 --- a/src/node/handler/APIHandler.js +++ b/src/node/handler/APIHandler.js @@ -67,6 +67,7 @@ var functions = { "isPasswordProtected" : ["padID"], "listAuthorsOfPad" : ["padID"], "padUsersCount" : ["padID"], + "getAuthorName" : ["authorID"], "padUsers" : ["padID"], "sendClientsMessage" : ["padID", "msg"] };