From 19bd6adccabd7ddebfba93ff3bb5394f37523e44 Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Mon, 5 Jan 2015 19:54:50 +0000 Subject: [PATCH] Add photo into update and fix HTML generator --- controller/smscontroller.php | 5 ++++- js/script.js | 8 ++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/controller/smscontroller.php b/controller/smscontroller.php index 9131fea..50916ed 100644 --- a/controller/smscontroller.php +++ b/controller/smscontroller.php @@ -189,7 +189,9 @@ class SmsController extends Controller { public function checkNewMessages($lastDate) { $phoneList = $this->smsMapper->getNewMessagesCountForAllPhonesNumbers($this->userId, $lastDate); $contactsSrc = $this->app->getContacts(); + $photosSrc = $this->app->getContactPhotos(); $contacts = array(); + $photos = array(); $countPhone = count($phoneList); foreach ($phoneList as $number => $ts) { @@ -198,10 +200,11 @@ class SmsController extends Controller { $fmtPN2 = preg_replace("#\/#","", $fmtPN); $contacts[$fmtPN] = $contactsSrc[$fmtPN]; $contacts[$fmtPN2] = $contactsSrc[$fmtPN]; + $photos[$fmtPN] = $photosSrc[$fmtPN]; } } - return new JSONResponse(array("phonelist" => $phoneList, "contacts" => $contacts)); + return new JSONResponse(array("phonelist" => $phoneList, "contacts" => $contacts, "photos" => $photos)); } /** diff --git a/js/script.js b/js/script.js index 6931e57..484bf6a 100644 --- a/js/script.js +++ b/js/script.js @@ -88,8 +88,13 @@ var checkNewMessages = function() { } if ($.inArray(peerLabel, bufferedContacts) == -1) { + $("div[mailbox-avatar='" + peerLabel + "']").remove(); $("a[mailbox-label='" + peerLabel + "']").remove(); - peerListBuf = '
  • ' + peerLabel + ' (' + val + ')
  • '; + peerListBuf += '
  • ' + peerLabel + ' (' + val + ')
  • '; $('#app-mailbox-peers ul').prepend(peerListBuf); bufferedContacts.push(peerLabel); @@ -289,7 +294,6 @@ function fetchInitialPeerList(jsondata) { peerLabel = fn; } if ($.inArray(peerLabel, bufferedContacts) == -1) { - //peerListBuf += '
  • ' + peerLabel + '
  • '; peerListBuf += '