From 745d7092ad1d77ae4a8ccfb339012b1869e5ffdb Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Thu, 22 Sep 2016 22:55:21 +0200 Subject: [PATCH] Add a fix for duplicates messages in database with or without spaces --- db/smsmapper.php | 4 ++++ js/public/app.js | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/db/smsmapper.php b/db/smsmapper.php index 657f617..bef1710 100644 --- a/db/smsmapper.php +++ b/db/smsmapper.php @@ -214,6 +214,10 @@ class SmsMapper extends Mapper { if (!in_array($phoneNumber, $phoneList)) { $phoneList[$phoneNumber] = $row["mx"]; } + // Maybe duplicate due to spaces in database + else if ($phoneList[$phoneNumber] < $row["mx"]) { + $phoneList[$phoneNumber] = $row["mx"]; + } } return $phoneList; } diff --git a/js/public/app.js b/js/public/app.js index 78d3076..6901e49 100644 --- a/js/public/app.js +++ b/js/public/app.js @@ -155,7 +155,7 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile' var phoneNumberLabel = $scope.selectedContact.nav; if (typeof jsondata['phoneNumbers'] != 'undefined') { - phoneNumberList = arrayUnique(jsondata['phoneNumbers']); + var phoneNumberList = arrayUnique(jsondata['phoneNumbers']); phoneNumberLabel = phoneNumberList.toString(); } @@ -491,7 +491,6 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile' changeSelectedConversation($("a[mailbox-navigation='" + urlPhoneNumber + "']")); } } - }); $scope.fetchInitialSettings(); $scope.initDesktopNotifies();