mirror of
				https://github.com/pierre42100/ComunicWeb
				synced 2025-11-03 19:54:14 +00:00 
			
		
		
		
	Search results are correctly shown
This commit is contained in:
		@@ -16,36 +16,44 @@ ComunicWeb.user.userInfos = {
 | 
			
		||||
     * 
 | 
			
		||||
     * @param {String} userID User on which to make request (current to get connected user)
 | 
			
		||||
     * @param {function} afterGetUserInfos What to do once user informations are available
 | 
			
		||||
     * @return {Boolean} False if it fails
 | 
			
		||||
     * @return {Boolean} True for a success
 | 
			
		||||
     */
 | 
			
		||||
    getUserInfos: function(userID, afterGetUserInfos){
 | 
			
		||||
 | 
			
		||||
        //If requested user is the current user, replace "current" with userID
 | 
			
		||||
        if(userID === "current")
 | 
			
		||||
            userID = ComunicWeb.user.userLogin.__userID;
 | 
			
		||||
 | 
			
		||||
        //First, check if informations are already available in the cache
 | 
			
		||||
        if(this.usersInfos[userID])
 | 
			
		||||
        if(this.usersInfos[userID]){
 | 
			
		||||
            afterGetUserInfos(this.usersInfos[userID]); //Then return these informations now
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
            
 | 
			
		||||
        //Else we have to perform an API request
 | 
			
		||||
        if(userID == "current" || userID == ComunicWeb.user.userLogin.__userID){
 | 
			
		||||
            var apiURI = "user/getCurrentUserInfos";
 | 
			
		||||
            var params = {};
 | 
			
		||||
        }
 | 
			
		||||
        else{
 | 
			
		||||
            ComunicWeb.debug.logMessage("ERROR : getUserInfos not implemented for other user than the current one !");
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        var apiURI = "user/getInfos";
 | 
			
		||||
        var params = {
 | 
			
		||||
            userID: userID
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        //Specify what to do next
 | 
			
		||||
        var onceGetUserInfos = function(result){
 | 
			
		||||
            if(result.error){
 | 
			
		||||
                ComunicWeb.debug.logMessage("ERROR : couldn't get infos about user ID : "+userID+" !");
 | 
			
		||||
 | 
			
		||||
                //Returns the error to the next function
 | 
			
		||||
                afterGetUserInfos(result);
 | 
			
		||||
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
            else {
 | 
			
		||||
                //Save result
 | 
			
		||||
                ComunicWeb.user.userInfos.usersInfos[""+userID] = result[0];
 | 
			
		||||
 | 
			
		||||
                //Return result
 | 
			
		||||
                afterGetUserInfos(result[0]);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //Perform request
 | 
			
		||||
        ComunicWeb.common.api.makeAPIrequest(apiURI, params, true, onceGetUserInfos);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user