Create a new way to retrieve multiple groups information

This commit is contained in:
2019-05-19 16:43:54 +02:00
parent d1c339c414
commit dacab00ae4
3 changed files with 70 additions and 2 deletions

View File

@ -138,7 +138,7 @@ function getMultipleUsersInfo(usersID, afterGetUserInfos, forceRequest){
*
* @param {Array~Object} users The list of users to get
* @param {Boolean} force
* @returns {Promise}
* @returns {Promise<UsersList>}
*/
function getUsers(users, force) {
return new Promise((resolve, error) => {
@ -146,7 +146,7 @@ function getUsers(users, force) {
if(result.error)
error(result.error);
else
resolve(new UsersList(result));
@ -224,6 +224,22 @@ function getInfoMultipleGroups(IDs, callback, force){
ComunicWeb.components.groups.info.getInfoMultiple(IDs, callback, force);
}
/**
* Get information about multiple groups
*
* @param {Number[]} list The ID of the groups to get
* @param {Boolean} force Specify whether to force or not the request
* @return {Promise<GroupsList>}
*/
function getGroups(list, force){
return new Promise((resolve, reject) => {
getInfoMultipleGroups(list, result => {
if(result.error) reject(result.error);
else resolve(new GroupsList(result));
}, force);
});
}
/**
* Get the difference of time from now to a specified
* timestamp and return it as a string