Skip to content

Commit ef05dac

Browse files
authored
Merge pull request #54851 from nextcloud/backport/54847/stable30
[stable30] fix: the account files filter should also work in trashbin
2 parents f74f15f + 92ab77e commit ef05dac

File tree

6 files changed

+31
-11
lines changed

6 files changed

+31
-11
lines changed

apps/files/src/components/FileListFilter/FileListFilter.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ defineEmits<{
4040

4141
<style scoped>
4242
.files-list-filter__clear-button :deep(.action-button__text) {
43-
color: var(--color-error-text);
43+
color: var(--color-text-error, var(--color-error-text));
4444
}
4545
4646
:deep(.button-vue) {

apps/files_sharing/src/filters/AccountFilter.ts

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,30 @@ class AccountFilter extends FileListFilter {
6161
const userIds = this.filterAccounts.map(({ uid }) => uid)
6262
// Filter if the owner of the node is in the list of filtered accounts
6363
return nodes.filter((node) => {
64-
const sharees = node.attributes.sharees?.sharee as { id: string }[] | undefined
65-
// If the node provides no information lets keep it
66-
if (!node.owner && !sharees) {
67-
return true
64+
if (window.OCP.Files.Router.params.view === TRASHBIN_VIEW_ID) {
65+
const deletedBy = node.attributes?.['trashbin-deleted-by-id']
66+
if (deletedBy && userIds.includes(deletedBy)) {
67+
return true
68+
}
69+
return false
6870
}
71+
6972
// if the owner matches
7073
if (node.owner && userIds.includes(node.owner)) {
7174
return true
7275
}
76+
7377
// 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)
78+
const sharees = node.attributes.sharees?.sharee as { id: string }[] | undefined
7479
if (sharees && [sharees].flat().some(({ id }) => userIds.includes(id))) {
7580
return true
7681
}
82+
83+
// If the node provides no information lets keep it
84+
if (!node.owner && !sharees) {
85+
return true
86+
}
87+
7788
// Not a valid node for the current filter
7889
return false
7990
})
@@ -138,6 +149,15 @@ class AccountFilter extends FileListFilter {
138149
})
139150
}
140151
}
152+
153+
// lets also handle trashbin
154+
const deletedBy = node.attributes?.['trashbin-deleted-by-id']
155+
if (deletedBy) {
156+
available.set(deletedBy, {
157+
uid: deletedBy,
158+
displayName: node.attributes?.['trashbin-deleted-by-display-name'] || deletedBy,
159+
})
160+
}
141161
}
142162

143163
this.availableAccounts = [...available.values()]

dist/files-init.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files-init.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files_sharing-init.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files_sharing-init.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)