From 71b178947e3ec807ac9dbbbda99322d0c3939adb Mon Sep 17 00:00:00 2001 From: Greg Ross Date: Sat, 30 Jun 2018 09:11:04 -0400 Subject: [PATCH] Fix the initial display of a conversation (#248) * Fix the initial display of a conversation Loop up the contact details if the page has been passed in a phone number as a url parameter on initial page load. --- js/devel/legacy.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/js/devel/legacy.js b/js/devel/legacy.js index 05f3f36..fc68759 100644 --- a/js/devel/legacy.js +++ b/js/devel/legacy.js @@ -384,8 +384,16 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile' $scope.selectedContact.label = urlPhoneNumber; $scope.selectedContact.nav = urlPhoneNumber; $scope.selectedContact.avatar = undefined; + + // Now let's loop through the contact list and see if we can find the rest of the details + for (let i = 0; i < $scope.contacts.length; i++) { + if ($scope.contacts[i].nav == urlPhoneNumber) { + $scope.selectedContact = $scope.contacts[i]; + break; + } + } } - $scope.fetchConversation(null); + $scope.fetchConversation($scope.selectedContact); Sms.selectConversation($("a[mailbox-navigation='" + urlPhoneNumber + "']")); } } @@ -393,6 +401,7 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile' SmsSettings.init(); SmsNotifications.init(); $scope.checkNewMessages(); + $scope.refreshConversation(); }); } ]);