mirror of
				https://github.com/pierre42100/ComunicWeb
				synced 2025-11-03 19:54:14 +00:00 
			
		
		
		
	Added remove method
This commit is contained in:
		@@ -33,6 +33,29 @@ ComunicWeb.components.conversations.cachingOpened = {
 | 
			
		||||
		return true;
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Remove a conversation from the list
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @param {Integer} conversationID The ID of the conversation to remove
 | 
			
		||||
	 * @return {Boolean} True for a success
 | 
			
		||||
	 */
 | 
			
		||||
	remove: function(conversationID){
 | 
			
		||||
		
 | 
			
		||||
		var conversations = this.getAll();
 | 
			
		||||
 | 
			
		||||
		if(!conversations.includes(conversationID.toString())){
 | 
			
		||||
			return false; //The conversation was not found
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		//Remove the entry
 | 
			
		||||
		var entryNumber = conversations.indexOf(conversationID.toString());
 | 
			
		||||
		conversations.splice(entryNumber, 1);
 | 
			
		||||
 | 
			
		||||
		//Save the new values
 | 
			
		||||
		var conversationsString = conversations.join(";");
 | 
			
		||||
		sessionStorage.setItem(this.__varName, conversationsString);
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Get all conversations ID in the list
 | 
			
		||||
	 * 
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user