1
0
mirror of https://github.com/nerzhul/ocsms.git synced 2025-06-07 07:56:23 +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
* You can now limit messages shown when loading a conversation
* Update AngularJS to 1.4.9

View File

@ -237,6 +237,7 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile'
$scope.messages = [];
});
$scope.selectedContact.nav = "";
OC.Util.History.pushState('');
});
};
@ -307,7 +308,6 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile'
$scope.fetchInitialPeerList = function (jsondata) {
// Use a buffer for better jQuery performance
var peerListBuf = "";
var photoPrefix = "";
var bufferedContacts = [];
@ -317,16 +317,14 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile'
}
$.each(jsondata['phonelist'], function(id, val) {
var fn, peerLabel, idxVal;
var peerLabel, idxVal;
idxVal = id.replace(/\//g,' ');
idxVal2 = idxVal.replace('/ /g','');
if (typeof jsondata['contacts'][id] == 'undefined') {
fn = '';
peerLabel = idxVal;
}
else {
fn = jsondata['contacts'][id];
peerLabel = fn;
peerLabel = jsondata['contacts'][id];
}
if (!inArray(peerLabel, bufferedContacts)) {
$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) {
var urlPhoneNumber = decodeURIComponent(pnParam);
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);
changeSelectedConversation($("a[mailbox-navigation='" + urlPhoneNumber + "']"));
}