Skip to content

Commit

Permalink
Merge pull request #47365 from nextcloud/fix/share-sorting
Browse files Browse the repository at this point in the history
fix(files_sharing): Sort by correct share attribute ("share with displayname")
  • Loading branch information
AndyScherzinger authored Aug 21, 2024
2 parents 1907eee + d6cfcd7 commit cf56874
Show file tree
Hide file tree
Showing 90 changed files with 143 additions and 140 deletions.
29 changes: 16 additions & 13 deletions apps/files_sharing/src/views/SharingTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,12 @@
</template>

<script>
import { CollectionList } from 'nextcloud-vue-collections'
import { generateOcsUrl } from '@nextcloud/router'
import NcAvatar from '@nextcloud/vue/dist/Components/NcAvatar.js'
import axios from '@nextcloud/axios'
import { orderBy } from '@nextcloud/files'
import { loadState } from '@nextcloud/initial-state'
import { generateOcsUrl } from '@nextcloud/router'
import { CollectionList } from 'nextcloud-vue-collections'
import NcAvatar from '@nextcloud/vue/dist/Components/NcAvatar.js'

import Config from '../services/ConfigService.ts'
import { shareWithTitle } from '../utils/SharedWithMe.js'
Expand Down Expand Up @@ -260,16 +261,18 @@ export default {
*/
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) => {
const localCompare = a.title.localeCompare(b.title)
if (localCompare !== 0) {
return localCompare
}
return b.createdTime - a.createdTime
})
const shares = orderBy(
data.ocs.data.map(share => new Share(share)),
[
// First order by the "share with" label
(share) => share.shareWithDisplayName,
// Then by the label
(share) => share.label,
// And last resort order by createdTime
(share) => share.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
4 changes: 2 additions & 2 deletions dist/4696-4696.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/4696-4696.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions dist/8707-8707.js

Large diffs are not rendered by default.

File renamed without changes.
1 change: 1 addition & 0 deletions dist/8707-8707.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/8707-8707.js.map.license
2 changes: 0 additions & 2 deletions dist/8953-8953.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/8953-8953.js.map

This file was deleted.

1 change: 0 additions & 1 deletion dist/8953-8953.js.map.license

This file was deleted.

4 changes: 2 additions & 2 deletions dist/comments-comments-app.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/comments-comments-app.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/comments-comments-tab.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/comments-comments-tab.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/core-legacy-unified-search.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/core-legacy-unified-search.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/core-login.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/core-login.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/core-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/core-main.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/core-profile.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/core-profile.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/dav-settings-personal-availability.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/dav-settings-personal-availability.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit cf56874

Please sign in to comment.