mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-26 13:59:23 +00:00
Added remove method
This commit is contained in:
parent
9923b67d2e
commit
3e5ce7c97a
@ -33,6 +33,29 @@ ComunicWeb.components.conversations.cachingOpened = {
|
|||||||
return true;
|
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
|
* Get all conversations ID in the list
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user