1
0
mirror of https://github.com/nerzhul/ocsms.git synced 2025-06-07 16:06:15 +00:00

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.
This commit is contained in:
Greg Ross 2018-06-30 09:11:04 -04:00 committed by Loïc Blot
parent e0508145dd
commit 71b178947e

View File

@ -384,8 +384,16 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile'
$scope.selectedContact.label = urlPhoneNumber; $scope.selectedContact.label = urlPhoneNumber;
$scope.selectedContact.nav = urlPhoneNumber; $scope.selectedContact.nav = urlPhoneNumber;
$scope.selectedContact.avatar = undefined; $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 + "']")); Sms.selectConversation($("a[mailbox-navigation='" + urlPhoneNumber + "']"));
} }
} }
@ -393,6 +401,7 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile'
SmsSettings.init(); SmsSettings.init();
SmsNotifications.init(); SmsNotifications.init();
$scope.checkNewMessages(); $scope.checkNewMessages();
$scope.refreshConversation();
}); });
} }
]); ]);