mirror of
https://github.com/nerzhul/ocsms.git
synced 2025-06-08 16:36:25 +00:00
Remove duplicate phonenumbers in conversation list
This commit is contained in:
parent
c4a78bf584
commit
a620277d86
@ -200,14 +200,21 @@ function fetchConversation(phoneNumber) {
|
|||||||
var len = jsondata["phoneNumbers"].length;
|
var len = jsondata["phoneNumbers"].length;
|
||||||
var ctLen = 0;
|
var ctLen = 0;
|
||||||
phoneNumberLabel = '';
|
phoneNumberLabel = '';
|
||||||
|
// This array permit to remove double entries
|
||||||
|
phoneNumberShown = [];
|
||||||
|
|
||||||
$.each(jsondata["phoneNumbers"], function(id, val) {
|
$.each(jsondata["phoneNumbers"], function(id, val) {
|
||||||
|
// Don't add phone numbers is they are already shown
|
||||||
|
if ($.inArray(val, phoneNumberShown)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
phoneNumberLabel += val;
|
phoneNumberLabel += val;
|
||||||
ctLen++;
|
ctLen++;
|
||||||
if (ctLen != len) {
|
if (ctLen != len) {
|
||||||
phoneNumberLabel += ",";
|
phoneNumberLabel += ",";
|
||||||
}
|
}
|
||||||
phoneNumberLabel += " ";
|
phoneNumberLabel += " ";
|
||||||
|
phoneNumberShown.push(val);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user