mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-23 00:46:16 -04:00
Add in padUsers HTTP API call
I needed the list of users this time, so I got it. There are docs and everything.
This commit is contained in:
parent
9b1673c60f
commit
f9469ef256
4 changed files with 29 additions and 0 deletions
|
@ -48,6 +48,7 @@ exports.createGroupPad = groupManager.createGroupPad;
|
|||
exports.createAuthor = authorManager.createAuthor;
|
||||
exports.createAuthorIfNotExistsFor = authorManager.createAuthorIfNotExistsFor;
|
||||
exports.listPadsOfAuthor = authorManager.listPadsOfAuthor;
|
||||
exports.padUsers = padMessageHandler.padUsers;
|
||||
exports.padUsersCount = padMessageHandler.padUsersCount;
|
||||
|
||||
/**********************/
|
||||
|
|
|
@ -67,6 +67,7 @@ var functions = {
|
|||
"isPasswordProtected" : ["padID"],
|
||||
"listAuthorsOfPad" : ["padID"],
|
||||
"padUsersCount" : ["padID"],
|
||||
"padUsers" : ["padID"],
|
||||
"sendClientsMessage" : ["padID", "msg"]
|
||||
};
|
||||
|
||||
|
|
|
@ -1410,3 +1410,26 @@ exports.padUsersCount = function (padID, callback) {
|
|||
callback(null, {padUsersCount: pad2sessions[padID].length});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of users in a pad
|
||||
*/
|
||||
exports.padUsers = function (padID, callback) {
|
||||
if (!pad2sessions[padID] || typeof pad2sessions[padID] != typeof []) {
|
||||
callback(null, {padUsers: []});
|
||||
} else {
|
||||
var authors = [];
|
||||
for ( var ix in sessioninfos ) {
|
||||
if ( sessioninfos[ix].padId !== padID ) {
|
||||
continue;
|
||||
}
|
||||
var aid = sessioninfos[ix].author;
|
||||
authorManager.getAuthor( aid, function ( err, author ) {
|
||||
authors.push( author );
|
||||
if ( authors.length === pad2sessions[padID].length ) {
|
||||
callback(null, {padUsers: authors});
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue