зеркало из https://github.com/nextcloud/spreed.git
Merge pull request #754 from nextcloud/bugfix/noid/correct-roomlist-sorting
Sort correctly room collection.
This commit is contained in:
Коммит
fc4c4ae77b
|
@ -28,8 +28,15 @@
|
|||
|
||||
var RoomCollection = Backbone.Collection.extend({
|
||||
model: OCA.SpreedMe.Models.Room,
|
||||
comparator: function(model) {
|
||||
return [model.get('active') ? -1 : 0, -(model.get('lastPing'))];
|
||||
comparator: function(modelA, modelB) {
|
||||
var activeA = modelA.get('active'),
|
||||
activeB = modelB.get('active');
|
||||
|
||||
if (activeA !== activeB) {
|
||||
return activeB - activeA;
|
||||
}
|
||||
|
||||
return modelB.get('lastPing') - modelA.get('lastPing');
|
||||
},
|
||||
url: OC.linkToOCS('apps/spreed/api/v1', 2) + 'room',
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче