mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 07:56:16 -04:00
PadMessageHandler.js: convert two remaining API calls to thenify
This commit is contained in:
parent
17fe32ec0c
commit
ec5baa2ab3
1 changed files with 5 additions and 4 deletions
|
@ -38,6 +38,7 @@ var hooks = require("ep_etherpad-lite/static/js/pluginfw/hooks.js");
|
||||||
var channels = require("channels");
|
var channels = require("channels");
|
||||||
var stats = require('../stats');
|
var stats = require('../stats');
|
||||||
var remoteAddress = require("../utils/RemoteAddress").remoteAddress;
|
var remoteAddress = require("../utils/RemoteAddress").remoteAddress;
|
||||||
|
const thenify = require("thenify").withCallback;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A associative array that saves informations about a session
|
* A associative array that saves informations about a session
|
||||||
|
@ -1788,16 +1789,16 @@ function _getRoomClients(padID) {
|
||||||
/**
|
/**
|
||||||
* Get the number of users in a pad
|
* Get the number of users in a pad
|
||||||
*/
|
*/
|
||||||
exports.padUsersCount = function(padID, callback) {
|
exports.padUsersCount = thenify(function(padID, callback) {
|
||||||
callback(null, {
|
callback(null, {
|
||||||
padUsersCount: _getRoomClients(padID).length
|
padUsersCount: _getRoomClients(padID).length
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the list of users in a pad
|
* Get the list of users in a pad
|
||||||
*/
|
*/
|
||||||
exports.padUsers = function(padID, callback) {
|
exports.padUsers = thenify(function(padID, callback) {
|
||||||
var result = [];
|
var result = [];
|
||||||
|
|
||||||
var roomClients = _getRoomClients(padID);
|
var roomClients = _getRoomClients(padID);
|
||||||
|
@ -1821,6 +1822,6 @@ exports.padUsers = function(padID, callback) {
|
||||||
|
|
||||||
callback(null, {padUsers: result});
|
callback(null, {padUsers: result});
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
|
|
||||||
exports.sessioninfos = sessioninfos;
|
exports.sessioninfos = sessioninfos;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue