From e09a6eb2887271e9cbda0daa833b01cfb25e5902 Mon Sep 17 00:00:00 2001 From: 2lar Date: Fri, 21 Apr 2023 14:45:36 -0400 Subject: [PATCH] adding branching feature --- apps/files_sharing/src/views/SharingTab.vue | 32 ++++++++++++--------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/apps/files_sharing/src/views/SharingTab.vue b/apps/files_sharing/src/views/SharingTab.vue index 7f424dd4b3230..cd215a495d3a0 100644 --- a/apps/files_sharing/src/views/SharingTab.vue +++ b/apps/files_sharing/src/views/SharingTab.vue @@ -275,20 +275,24 @@ export default { * @param {object} share the share ocs api request data * @param {object} share.data the request data */ - processShares({ data }) { - if (data.ocs && data.ocs.data && data.ocs.data.length > 0) { - // create Share objects and sort by newest - const shares = data.ocs.data - .map(share => new Share(share)) - .sort((a, b) => 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) - - console.debug('Processed', this.linkShares.length, 'link share(s)') - console.debug('Processed', this.shares.length, 'share(s)') - } - }, + processShares({ data }) { + if (data.ocs && data.ocs.data && data.ocs.data.length > 0) { + // 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) => { + if (a.title < b.title) return -1 + if (a.title > b.title) return 1 + 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) + + console.debug('Processed', this.linkShares.length, 'link share(s)') + console.debug('Processed', this.shares.length, 'share(s)') + } + }, /** * Process the sharedWithMe share data