mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 16:06:16 -04:00
Add 2 new APIs: listPadsOfAuthor and listAuthorsOfPad
Return all pads that a given author has contributed to (not just created) and return all authors who has contributed to a given pad.
This commit is contained in:
parent
0bc01feb72
commit
6f9d7a5db7
4 changed files with 132 additions and 2 deletions
|
@ -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
|
||||
|
@ -436,6 +440,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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue