Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(personal-files): correctly filters groupfolders now #44455

Merged
merged 2 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions apps/files/src/services/PersonalFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,22 @@ const currUserID = getCurrentUser()?.uid
* @param {FileStat} node that contains
* @return {Boolean}
*/
export const personalFile = function(node: File): Boolean {
const isNotShared = currUserID ? node.owner === currUserID : true
&& node.attributes['mount-type'] !== 'group'
&& node.attributes['mount-type'] !== 'shared'
return isNotShared
export const isPersonalFile = function(node: File): Boolean {
// the type of mounts that determine whether the file is shared
const sharedMountTypes = ["group", "shared"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be any kind of mount point? Are external storage excluded?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps. Is it not possible that these external storage's containing files still belong solely to the user? These mount types are more defined to be shared, so I think its best to leave it to these. It can change easily in the future though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, but they are still not personal files as "files in your personal folder".
Maybe @nextcloud/designers can give us their opinion

const mountType = node.attributes['mount-type']
// the check to determine whether the current logged in user is the owner / creator of the node
const currUserCreated = currUserID ? node.owner === currUserID : true

return currUserCreated && !sharedMountTypes.includes(mountType)
}

export const getContents = (path: string = "/"): Promise<ContentsWithRoot> => {
// get all the files from the current path as a cancellable promise
// then filter the files that the user does not own, or has shared / is a group folder
return getFiles(path)
.then(c => {
c.contents = c.contents.filter(personalFile) as File[]
c.contents = c.contents.filter(isPersonalFile) as File[]
return c
})
}
4 changes: 2 additions & 2 deletions dist/files-init.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

Loading