diff --git a/assets/js/components/calls/controller.js b/assets/js/components/calls/controller.js index 95dee3f3..9a19ba5b 100644 --- a/assets/js/components/calls/controller.js +++ b/assets/js/components/calls/controller.js @@ -142,6 +142,10 @@ ComunicWeb.components.calls.controller = { */ open: function(call){ + //Check if the call is already in the list of calls + if(ComunicWeb.components.calls.currentList.isCallInList(call.id)) + return; + //Add the call to the list of opened calls ComunicWeb.components.calls.currentList.addCallToList(call.id); diff --git a/assets/js/components/calls/currentList.js b/assets/js/components/calls/currentList.js index 9f4863a4..5bdf7842 100644 --- a/assets/js/components/calls/currentList.js +++ b/assets/js/components/calls/currentList.js @@ -27,6 +27,15 @@ ComunicWeb.components.calls.currentList = { return string.split(","); }, + /** + * Check if a call ID is in the list of opened calls + * + * @param {Number} id The ID of the call to check + */ + isCallInList: function(id){ + return this.getCurrentCallsList().includes(""+id); + }, + /** * Save a new list of calls *