1
0
mirror of https://github.com/nerzhul/ocsms.git synced 2025-06-07 07:56:23 +00:00

Remove duplicate phonenumbers in conversation list

This commit is contained in:
Ner'zhul 2015-06-08 16:23:54 +02:00
parent c4a78bf584
commit a620277d86

View File

@ -200,14 +200,21 @@ function fetchConversation(phoneNumber) {
var len = jsondata["phoneNumbers"].length;
var ctLen = 0;
phoneNumberLabel = '';
// This array permit to remove double entries
phoneNumberShown = [];
$.each(jsondata["phoneNumbers"], function(id, val) {
// Don't add phone numbers is they are already shown
if ($.inArray(val, phoneNumberShown)) {
continue;
}
phoneNumberLabel += val;
ctLen++;
if (ctLen != len) {
phoneNumberLabel += ",";
}
phoneNumberLabel += " ";
phoneNumberShown.push(val);
});
}