Some fixes to the contributor API methods

Mostly these are coding style adjustments
This commit is contained in:
Marcel Klehr 2012-06-27 21:02:41 +02:00
parent 6f9d7a5db7
commit 93b50d4a29
2 changed files with 4 additions and 7 deletions

View File

@ -165,7 +165,6 @@ exports.setAuthorColorId = function (author, colorId, callback)
/** /**
* Returns the name of the author * Returns the name of the author
* @param {String} author The id of the author * @param {String} author The id of the author
* @param {String} name The name of the author
* @param {Function} callback callback(err, name) * @param {Function} callback callback(err, name)
*/ */
exports.getAuthorName = function (author, callback) exports.getAuthorName = function (author, callback)
@ -176,6 +175,7 @@ exports.getAuthorName = function (author, callback)
/** /**
* Sets the name of the author * Sets the name of the author
* @param {String} author The id of the author * @param {String} author The id of the author
* @param {String} name The name of the author
* @param {Function} callback (optional) * @param {Function} callback (optional)
*/ */
exports.setAuthorName = function (author, name, callback) exports.setAuthorName = function (author, name, callback)
@ -186,7 +186,6 @@ exports.setAuthorName = function (author, name, callback)
/** /**
* Returns an array of all pads this author contributed to * Returns an array of all pads this author contributed to
* @param {String} author The id of the author * @param {String} author The id of the author
* @param {String} name The name of the author
* @param {Function} callback (optional) * @param {Function} callback (optional)
*/ */
exports.listPadsOfAuthor = function (authorID, callback) exports.listPadsOfAuthor = function (authorID, callback)
@ -225,7 +224,6 @@ exports.listPadsOfAuthor = function (authorID, callback)
* Adds a new pad to the list of contributions * Adds a new pad to the list of contributions
* @param {String} author The id of the author * @param {String} author The id of the author
* @param {String} padID The id of the pad the author contributes to * @param {String} padID The id of the pad the author contributes to
* @param {Function} callback (optional)
*/ */
exports.addPad = function (authorID, padID) exports.addPad = function (authorID, padID)
{ {
@ -238,11 +236,11 @@ exports.addPad = function (authorID, padID)
//the entry doesn't exist so far, let's create it //the entry doesn't exist so far, let's create it
if(author.padIDs == null) if(author.padIDs == null)
{ {
author.padIDs = {padIDs : {}}; author.padIDs = {};
} }
//add the entry for this pad //add the entry for this pad
author.padIDs[padID] = 1; author.padIDs[padID] = 1;// anything, because value is not used
//save the new element back //save the new element back
db.set("globalAuthor:" + authorID, author); db.set("globalAuthor:" + authorID, author);
@ -253,7 +251,6 @@ exports.addPad = function (authorID, padID)
* Removes a pad from the list of contributions * Removes a pad from the list of contributions
* @param {String} author The id of the author * @param {String} author The id of the author
* @param {String} padID The id of the pad the author contributes to * @param {String} padID The id of the pad the author contributes to
* @param {Function} callback (optional)
*/ */
exports.removePad = function (authorID, padID) exports.removePad = function (authorID, padID)
{ {

View File

@ -84,7 +84,7 @@ Pad.prototype.appendRevision = function appendRevision(aChangeset, author) {
this.saveToDatabase(); this.saveToDatabase();
// set the author to pad // set the author to pad
if(author != '') if(author)
authorManager.addPad(author, this.id); authorManager.addPad(author, this.id);
}; };