mirror of
				https://github.com/pierre42100/ComunicWeb
				synced 2025-11-04 12:14:12 +00:00 
			
		
		
		
	Upgrade user memberships pane
This commit is contained in:
		@@ -177,7 +177,7 @@ const ConversationsInterface = {
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		//Else, perform an API request
 | 
			
		||||
		var apiURI = "conversations/getInfosOne";
 | 
			
		||||
		var apiURI = "conversations/get_single";
 | 
			
		||||
		var params = {
 | 
			
		||||
			conversationID: conversationID,
 | 
			
		||||
		};
 | 
			
		||||
 
 | 
			
		||||
@@ -9,32 +9,28 @@ const ConversationsUtils = {
 | 
			
		||||
	/**
 | 
			
		||||
	 * Given conversation informations, returns its name
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @param {Object} infos Conversation informations
 | 
			
		||||
	 * @param {Conversation} info Conversation information
 | 
			
		||||
	 * @param {Function} afterName What to do once we got conversation name
 | 
			
		||||
	 * @return {Boolean} True for a success
 | 
			
		||||
	 */
 | 
			
		||||
	getName: function(infos, afterName){
 | 
			
		||||
	getName: function(info, afterName){
 | 
			
		||||
 | 
			
		||||
		//Check if the conversation has a name or not
 | 
			
		||||
		if(infos.name)
 | 
			
		||||
			afterName(infos.name);
 | 
			
		||||
		if(info.name && info.name.length > 0)
 | 
			
		||||
			afterName(info.name);
 | 
			
		||||
		else {
 | 
			
		||||
 | 
			
		||||
			//Get informations about the first two members
 | 
			
		||||
			var firstMembers = [];
 | 
			
		||||
 | 
			
		||||
			//Retrieve IDs
 | 
			
		||||
			for(o in infos.members){
 | 
			
		||||
			for(o in info.members){
 | 
			
		||||
				//Limit number to 2
 | 
			
		||||
				if(firstMembers.length < 2){ 
 | 
			
		||||
				if(firstMembers.length < 2){
 | 
			
		||||
					//Exclude current user ID
 | 
			
		||||
					if(info.members[o].user_id != userID()) 
 | 
			
		||||
						firstMembers.push(info.members[o].user_id);
 | 
			
		||||
 | 
			
		||||
					//Check this is a valid entry
 | 
			
		||||
					if(infos.members[o]){
 | 
			
		||||
 | 
			
		||||
						//Exclude current user ID
 | 
			
		||||
						if(infos.members[o] != userID()) 
 | 
			
		||||
							firstMembers.push(infos.members[o]);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
@@ -42,7 +38,7 @@ const ConversationsUtils = {
 | 
			
		||||
			ComunicWeb.user.userInfos.getNames(firstMembers, function(usersName){
 | 
			
		||||
 | 
			
		||||
				//For conversations with many members (more than 3 - we musn't forget current user)
 | 
			
		||||
				if(infos.members.length > 3)
 | 
			
		||||
				if(info.members.length > 3)
 | 
			
		||||
					usersName += ", ...";
 | 
			
		||||
 | 
			
		||||
				//Peform next action now
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user