Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/mail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2018-01-15 22:50:23 +0300
committerChristoph Wurst <christoph@winzerhof-wurst.at>2018-01-15 22:50:23 +0300
commitb303b1d8463ba3c450c647bbe8c3a0d15c6c7bea (patch)
tree740b5c220ce26af4520cd21dc5ba47679c64978f /lib/Controller/MessagesController.php
parent026a0f0826132dc04717baeca7dee2a4343007a1 (diff)
Sort attachment on the client-side
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/Controller/MessagesController.php')
-rwxr-xr-xlib/Controller/MessagesController.php19
1 files changed, 3 insertions, 16 deletions
diff --git a/lib/Controller/MessagesController.php b/lib/Controller/MessagesController.php
index 0b8a6c1b6..51eea5f26 100755
--- a/lib/Controller/MessagesController.php
+++ b/lib/Controller/MessagesController.php
@@ -48,7 +48,6 @@ use OCP\Files\IMimeTypeDetector;
use OCP\IL10N;
use OCP\IRequest;
use OCP\IURLGenerator;
-use OCP\Util;
class MessagesController extends Controller {
@@ -403,11 +402,9 @@ class MessagesController extends Controller {
$attachment['downloadUrl'] = $downloadUrl;
$attachment['mimeUrl'] = $this->mimeTypeDetector->mimeTypeIcon($attachment['mime']);
- if ($this->attachmentIsImage($attachment)) {
- $attachment['isImage'] = true;
- } else if ($this->attachmentIsCalendarEvent($attachment)) {
- $attachment['isCalendarEvent'] = true;
- }
+ $attachment['isImage'] = $this->attachmentIsImage($attachment);
+ $attachment['isCalendarEvent'] = $this->attachmentIsCalendarEvent($attachment);
+
return $attachment;
}
@@ -486,16 +483,6 @@ class MessagesController extends Controller {
return $this->enrichDownloadUrl($accountId, $folderId, $id, $a);
}, $json['attachments']);
- // show images first
- usort($json['attachments'], function($a, $b) {
- if (isset($a['isImage']) && !isset($b['isImage'])) {
- return -1;
- } elseif (!isset($a['isImage']) && isset($b['isImage'])) {
- return 1;
- } else {
- Util::naturalSortCompare($a['fileName'], $b['fileName']);
- }
- });
return $json;
}
return $json;