Skip to content

Commit 20428db

Browse files
2larAltahrim
authored andcommitted
fix(files_sharing): tab shares title and creation sort
Signed-off-by: Law [email protected]
1 parent 210158e commit 20428db

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

apps/files_sharing/src/views/SharingTab.vue

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -275,24 +275,25 @@ export default {
275275
* @param {object} share the share ocs api request data
276276
* @param {object} share.data the request data
277277
*/
278-
processShares({ data }) {
279-
if (data.ocs && data.ocs.data && data.ocs.data.length > 0) {
280-
// create Share objects and sort by title in alphabetical order and then by creation time
281-
const shares = data.ocs.data
282-
.map(share => new Share(share))
283-
.sort((a, b) => {
284-
if (a.title < b.title) return -1
285-
if (a.title > b.title) return 1
286-
return b.createdTime - a.createdTime
287-
})
288-
289-
this.linkShares = shares.filter(share => share.type === this.SHARE_TYPES.SHARE_TYPE_LINK || share.type === this.SHARE_TYPES.SHARE_TYPE_EMAIL)
290-
this.shares = shares.filter(share => share.type !== this.SHARE_TYPES.SHARE_TYPE_LINK && share.type !== this.SHARE_TYPES.SHARE_TYPE_EMAIL)
291-
292-
console.debug('Processed', this.linkShares.length, 'link share(s)')
293-
console.debug('Processed', this.shares.length, 'share(s)')
294-
}
295-
},
278+
processShares({ data }) {
279+
if (data.ocs && data.ocs.data && data.ocs.data.length > 0) {
280+
// create Share objects and sort by title in alphabetical order and then by creation time
281+
const shares = data.ocs.data
282+
.map(share => new Share(share))
283+
.sort((a, b) => {
284+
const localCompare = a.title.localeCompare(b.title)
285+
if (localCompare !== 0) {
286+
return localCompare
287+
}
288+
return b.createdTime - a.createdTime
289+
})
290+
this.linkShares = shares.filter(share => share.type === this.SHARE_TYPES.SHARE_TYPE_LINK || share.type === this.SHARE_TYPES.SHARE_TYPE_EMAIL)
291+
this.shares = shares.filter(share => share.type !== this.SHARE_TYPES.SHARE_TYPE_LINK && share.type !== this.SHARE_TYPES.SHARE_TYPE_EMAIL)
292+
293+
console.debug('Processed', this.linkShares.length, 'link share(s)')
294+
console.debug('Processed', this.shares.length, 'share(s)')
295+
}
296+
},
296297
297298
/**
298299
* Process the sharedWithMe share data

0 commit comments

Comments
 (0)