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

little fixes + order contacts by message date

This commit is contained in:
Loic Blot 2016-09-19 21:03:51 +02:00
parent fb952e00ef
commit 828320eb9d
2 changed files with 4 additions and 4 deletions

View File

@ -169,7 +169,7 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile'
var bufferedContacts = [];
$.each(jsondata['phonelist'], function(id, val) {
var fn, peerLabel, idxVal;
var fn, peerLabel, idxVal, idxVal2;
idxVal = id.replace(/\//g,' ');
idxVal2 = idxVal.replace('/ /g','');
if (typeof jsondata['contacts'][id] == 'undefined') {
@ -318,7 +318,7 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile'
}
$.each(jsondata['phonelist'], function(id, val) {
var peerLabel, idxVal;
var peerLabel, idxVal, idxVal2;
idxVal = id.replace(/\//g,' ');
idxVal2 = idxVal.replace('/ /g','');
if (typeof jsondata['contacts'][id] == 'undefined') {
@ -328,7 +328,7 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile'
peerLabel = jsondata['contacts'][id];
}
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, 'lastmsg': val});
bufferedContacts.push(peerLabel);
}
});

View File

@ -9,7 +9,7 @@ use \OCA\OcSms\Lib\CountryCodes;
<div class="ng-scope" id="app" ng-app="OcSms" ng-controller="OcSmsController">
<div id="app-mailbox-peers">
<ul class="contact-list">
<li ng-repeat="contact in contacts" peer-label="{{ contact.label }}" ng-click="loadConversation(contact);" href="#">
<li ng-repeat="contact in contacts | orderBy:'lastmsg'" peer-label="{{ contact.label }}" ng-click="loadConversation(contact);" href="#">
<img class="ocsms-plavatar" data-ng-src="data:image/png;base64,{{ contact.avatar }}" ng-show="contact.avatar !== undefined" />
<div class="ocsms-plavatar" ng-show="contact.avatar === undefined" ng-style="{'background-color': (contact.label | peerColor)}">{{ contact.label | firstCharacter }}</div>
<a class="ocsms-plname" style="{{ contact.unread > 0 ? 'font-weight:bold;' : ''}}" mailbox-label="{{ contact.label }}" mailbox-navigation="{{ contact.nav }}">{{ contact.label }}{{ contact.unread > 0 ? ' (' + contact.unread + ') ' : '' }}</a>