mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Merge pull request #54851 from nextcloud/backport/54847/stable30
[stable30] fix: the account files filter should also work in trashbin
This commit is contained in:
commit
ef05dac4cc
6 changed files with 31 additions and 11 deletions
|
|
@ -40,7 +40,7 @@ defineEmits<{
|
|||
|
||||
<style scoped>
|
||||
.files-list-filter__clear-button :deep(.action-button__text) {
|
||||
color: var(--color-error-text);
|
||||
color: var(--color-text-error, var(--color-error-text));
|
||||
}
|
||||
|
||||
:deep(.button-vue) {
|
||||
|
|
|
|||
|
|
@ -61,19 +61,30 @@ class AccountFilter extends FileListFilter {
|
|||
const userIds = this.filterAccounts.map(({ uid }) => uid)
|
||||
// Filter if the owner of the node is in the list of filtered accounts
|
||||
return nodes.filter((node) => {
|
||||
const sharees = node.attributes.sharees?.sharee as { id: string }[] | undefined
|
||||
// If the node provides no information lets keep it
|
||||
if (!node.owner && !sharees) {
|
||||
return true
|
||||
if (window.OCP.Files.Router.params.view === TRASHBIN_VIEW_ID) {
|
||||
const deletedBy = node.attributes?.['trashbin-deleted-by-id']
|
||||
if (deletedBy && userIds.includes(deletedBy)) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// if the owner matches
|
||||
if (node.owner && userIds.includes(node.owner)) {
|
||||
return true
|
||||
}
|
||||
|
||||
// Or any of the sharees (if only one share this will be an object, otherwise an array. So using `.flat()` to make it always an array)
|
||||
const sharees = node.attributes.sharees?.sharee as { id: string }[] | undefined
|
||||
if (sharees && [sharees].flat().some(({ id }) => userIds.includes(id))) {
|
||||
return true
|
||||
}
|
||||
|
||||
// If the node provides no information lets keep it
|
||||
if (!node.owner && !sharees) {
|
||||
return true
|
||||
}
|
||||
|
||||
// Not a valid node for the current filter
|
||||
return false
|
||||
})
|
||||
|
|
@ -138,6 +149,15 @@ class AccountFilter extends FileListFilter {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
// lets also handle trashbin
|
||||
const deletedBy = node.attributes?.['trashbin-deleted-by-id']
|
||||
if (deletedBy) {
|
||||
available.set(deletedBy, {
|
||||
uid: deletedBy,
|
||||
displayName: node.attributes?.['trashbin-deleted-by-display-name'] || deletedBy,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
this.availableAccounts = [...available.values()]
|
||||
|
|
|
|||
4
dist/files-init.js
vendored
4
dist/files-init.js
vendored
File diff suppressed because one or more lines are too long
2
dist/files-init.js.map
vendored
2
dist/files-init.js.map
vendored
File diff suppressed because one or more lines are too long
4
dist/files_sharing-init.js
vendored
4
dist/files_sharing-init.js
vendored
File diff suppressed because one or more lines are too long
2
dist/files_sharing-init.js.map
vendored
2
dist/files_sharing-init.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue