Merge pull request #819 from marcelklehr/contributor-api-methods

Contributor api methods (listPadsOfAuthor & listAuthorsOfPad )
This commit is contained in:
John McLear 2012-06-27 11:31:25 -07:00
commit a717c11ab3
4 changed files with 132 additions and 2 deletions

View file

@ -82,6 +82,10 @@ Pad.prototype.appendRevision = function appendRevision(aChangeset, author) {
db.set("pad:"+this.id+":revs:"+newRev, newRevData);
this.saveToDatabase();
// set the author to pad
if(author != '')
authorManager.addPad(author, this.id);
};
//save all attributes to the database
@ -442,6 +446,18 @@ Pad.prototype.remove = function remove(callback) {
db.remove("pad:"+padID+":revs:"+i);
}
callback();
},
//remove pad from all authors who contributed
function(callback)
{
var authorIDs = _this.getAllAuthors();
authorIDs.forEach(function (authorID)
{
authorManager.removePad(authorID, padID);
});
callback();
}
], callback);