From 43e3d13427b7e51b2967a391179cc998d07c4a74 Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Mon, 20 Jul 2015 00:27:41 +0300 Subject: [PATCH] Sort files by modify date Closes #850 --- app/js/controllers.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/js/controllers.js b/app/js/controllers.js index e38515553..228f3ab18 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -2159,6 +2159,12 @@ angular.module('myApp.controllers', ['myApp.i18n']) delete $scope.draftMessage.replyToMessage; + if (newVal[0].lastModified) { + newVal.sort(function (file1, file2) { + return file1.lastModified - file2.lastModified; + }); + } + for (var i = 0; i < newVal.length; i++) { AppMessagesManager.sendFile($scope.curDialog.peerID, newVal[i], options); $scope.$broadcast('ui_message_send');