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

Cleanup + fixes

* Fix changelog
* reset URL when deleting conversation
* create a factice contact where no contact was set as selected at loading
This commit is contained in:
Loic Blot 2016-05-19 23:00:25 +02:00
parent 64939e31d7
commit 0ddc2a8b45
2 changed files with 13 additions and 5 deletions

View File

@ -1,3 +1,8 @@
1.7.0 (-CURRENT)
* Enhance the contact list using nicer list like in contact app
* PHP code cleanup (thanks to PHPStorm)
* Angular app code cleanup & enhancements
1.6.0 1.6.0
* You can now limit messages shown when loading a conversation * You can now limit messages shown when loading a conversation
* Update AngularJS to 1.4.9 * Update AngularJS to 1.4.9

View File

@ -237,6 +237,7 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile'
$scope.messages = []; $scope.messages = [];
}); });
$scope.selectedContact.nav = ""; $scope.selectedContact.nav = "";
OC.Util.History.pushState('');
}); });
}; };
@ -307,7 +308,6 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile'
$scope.fetchInitialPeerList = function (jsondata) { $scope.fetchInitialPeerList = function (jsondata) {
// Use a buffer for better jQuery performance // Use a buffer for better jQuery performance
var peerListBuf = "";
var photoPrefix = ""; var photoPrefix = "";
var bufferedContacts = []; var bufferedContacts = [];
@ -317,16 +317,14 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile'
} }
$.each(jsondata['phonelist'], function(id, val) { $.each(jsondata['phonelist'], function(id, val) {
var fn, peerLabel, idxVal; var peerLabel, idxVal;
idxVal = id.replace(/\//g,' '); idxVal = id.replace(/\//g,' ');
idxVal2 = idxVal.replace('/ /g',''); idxVal2 = idxVal.replace('/ /g','');
if (typeof jsondata['contacts'][id] == 'undefined') { if (typeof jsondata['contacts'][id] == 'undefined') {
fn = '';
peerLabel = idxVal; peerLabel = idxVal;
} }
else { else {
fn = jsondata['contacts'][id]; peerLabel = jsondata['contacts'][id];
peerLabel = fn;
} }
if (!inArray(peerLabel, bufferedContacts)) { if (!inArray(peerLabel, bufferedContacts)) {
$scope.addContact({'label': peerLabel, 'nav': idxVal2, 'avatar': photoPrefix + jsondata['photos'][peerLabel], 'unread' : 0}); $scope.addContact({'label': peerLabel, 'nav': idxVal2, 'avatar': photoPrefix + jsondata['photos'][peerLabel], 'unread' : 0});
@ -422,6 +420,11 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile'
if (pnParam != null) { if (pnParam != null) {
var urlPhoneNumber = decodeURIComponent(pnParam); var urlPhoneNumber = decodeURIComponent(pnParam);
if (urlPhoneNumber != null) { if (urlPhoneNumber != null) {
// If no contact when loading, creating a new contact from urlPhoneNumber
if ($scope.selectedContact.nav === undefined) {
$scope.selectedContact.label = urlPhoneNumber;
$scope.selectedContact.nav = urlPhoneNumber;
}
$scope.fetchConversation(null); $scope.fetchConversation(null);
changeSelectedConversation($("a[mailbox-navigation='" + urlPhoneNumber + "']")); changeSelectedConversation($("a[mailbox-navigation='" + urlPhoneNumber + "']"));
} }