From b9fba1689340d4f5b6954d09bc04b791c0c0776b Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Mon, 19 Sep 2016 22:25:21 +0200 Subject: [PATCH] Fix avatars in contact list --- js/public/app.js | 8 ++------ lib/contactcache.php | 8 +------- templates/main.php | 6 +++--- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/js/public/app.js b/js/public/app.js index b63e81d..9f16c0c 100644 --- a/js/public/app.js +++ b/js/public/app.js @@ -320,13 +320,9 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile' $scope.fetchInitialPeerList = function (jsondata) { // Use a buffer for better jQuery performance - var photoPrefix = ""; var bufferedContacts = []; $scope.photoVersion = jsondata["photo_version"]; - if ($scope.photoVersion >= 2) { - photoPrefix = "data:image/png;base64,"; - } $.each(jsondata['phonelist'], function(id, val) { var peerLabel, idxVal, idxVal2; @@ -347,7 +343,7 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile' }; if (typeof(jsondata['photos'][peerLabel]) != 'undefined') { - contactObj['avatar'] = photoPrefix + jsondata['photos'][peerLabel]; + contactObj['avatar'] = jsondata['photos'][peerLabel]; } $scope.addContact(contactObj); bufferedContacts.push(peerLabel); @@ -446,7 +442,7 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile' if ($scope.selectedContact.nav === undefined) { $scope.selectedContact.label = urlPhoneNumber; $scope.selectedContact.nav = urlPhoneNumber; - $scope.selectedContact.avatar = ""; + $scope.selectedContact.avatar = undefined; } $scope.fetchConversation(null); changeSelectedConversation($("a[mailbox-navigation='" + urlPhoneNumber + "']")); diff --git a/lib/contactcache.php b/lib/contactcache.php index 354c031..91a409e 100644 --- a/lib/contactcache.php +++ b/lib/contactcache.php @@ -93,15 +93,9 @@ class ContactCache { if (isset ($r["PHOTO"])) { // Remove useless prefix - // @TODO detect owncloud version $ocversion = \OCP\Util::getVersion(); $photoURL = preg_replace("#^VALUE=uri:#","",$r["PHOTO"], 1); - if (version_compare($ocversion[0].".".$ocversion[1].".".$ocversion[2], "9.0.0", ">=")) { - $this->contactPhotos[$r["FN"]] = base64_encode($photoURL); - } - else { - $this->contactPhotos[$r["FN"]] = $photoURL; - } + $this->contactPhotos[$r["FN"]] = $photoURL; } } } diff --git a/templates/main.php b/templates/main.php index 95b78f9..919ae48 100644 --- a/templates/main.php +++ b/templates/main.php @@ -10,7 +10,7 @@ use \OCA\OcSms\Lib\CountryCodes;