Skip to content

Commit

Permalink
fix(files_sharing): tab shares title and creation sort
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
  • Loading branch information
2lar authored and Altahrim committed Mar 26, 2024
1 parent 47ac907 commit 4331e54
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions apps/files_sharing/src/views/SharingTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4331e54

Please sign in to comment.