Can force the request to get multiple groups.

This commit is contained in:
Pierre HUBERT 2018-09-02 14:14:10 +02:00
parent 1c1dbe8454
commit e8df43351f
2 changed files with 6 additions and 4 deletions

View File

@ -167,7 +167,8 @@ function getInfoGroup(id, callback){
* *
* @param {Array} IDs The IDs of the groups to get information about * @param {Array} IDs The IDs of the groups to get information about
* @param {Function} callback Callback to call once we have information about the group * @param {Function} callback Callback to call once we have information about the group
* @param {Boolean} force TRUE to force the request (ignore cache)
*/ */
function getInfoMultipleGroups(IDs, callback){ function getInfoMultipleGroups(IDs, callback, force){
ComunicWeb.components.groups.info.getInfoMultiple(IDs, callback); ComunicWeb.components.groups.info.getInfoMultiple(IDs, callback, force);
} }

View File

@ -44,14 +44,15 @@ ComunicWeb.components.groups.info = {
* *
* @param {Array} list The list of the IDs of the group to get information about * @param {Array} list The list of the IDs of the group to get information about
* @param {Function} callback * @param {Function} callback
* @param {Boolean} force TRUE to ignore cache (FALSE by default)
*/ */
getInfoMultiple: function(list, callback){ getInfoMultiple: function(list, callback, force){
//First, check which group are unknown in the cache //First, check which group are unknown in the cache
var toFetch = Array(); var toFetch = Array();
list.forEach(function(id){ list.forEach(function(id){
if(!ComunicWeb.components.groups.info._cache[id]) if(!ComunicWeb.components.groups.info._cache[id] || force)
toFetch.push(id); toFetch.push(id);
}); });