Added remove method

This commit is contained in:
Pierre 2017-06-14 16:01:16 +02:00
parent 9923b67d2e
commit 3e5ce7c97a

View File

@ -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
*