From 4331e54db4071108d271d8e5c259e57711dbfa42 Mon Sep 17 00:00:00 2001 From: 2lar Date: Fri, 21 Apr 2023 14:45:36 -0400 Subject: [PATCH] fix(files_sharing): tab shares title and creation sort Signed-off-by: Benjamin Gaussorgues --- apps/files_sharing/src/views/SharingTab.vue | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/files_sharing/src/views/SharingTab.vue b/apps/files_sharing/src/views/SharingTab.vue index 7f424dd4b3230..ee82db789384e 100644 --- a/apps/files_sharing/src/views/SharingTab.vue +++ b/apps/files_sharing/src/views/SharingTab.vue @@ -277,11 +277,16 @@ export default { */ processShares({ data }) { if (data.ocs && data.ocs.data && data.ocs.data.length > 0) { - // create Share objects and sort by newest + // create Share objects and sort by title in alphabetical order and then by creation time const shares = data.ocs.data .map(share => new Share(share)) - .sort((a, b) => b.createdTime - a.createdTime) - + .sort((a, b) => { + const localCompare = a.title.localeCompare(b.title) + if (localCompare !== 0) { + return localCompare + } + return b.createdTime - a.createdTime + }) this.linkShares = shares.filter(share => share.type === this.SHARE_TYPES.SHARE_TYPE_LINK || share.type === this.SHARE_TYPES.SHARE_TYPE_EMAIL) this.shares = shares.filter(share => share.type !== this.SHARE_TYPES.SHARE_TYPE_LINK && share.type !== this.SHARE_TYPES.SHARE_TYPE_EMAIL)