Skip to content

Commit

Permalink
Filter out current bucket (#1548)
Browse files Browse the repository at this point in the history
* filter out current bucket

* Update packages/files-ui/src/Components/Modules/FileBrowsers/ShareModal.tsx
  • Loading branch information
Tbaut authored Sep 21, 2021
1 parent 36eefa5 commit 736b881
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,16 @@ const ShareModal = ({ close, file, filePath }: IShareFileProps) => {

return buckets
.filter(buck => buck.type === "share" || buck.type === "csf")
// filter out the current bucket
.filter(buck => buck.id !== bucket?.id)
// all buckets where the user is reader or writer
.filter(buck => !!buck.writers.find((w) => w.uuid === profile.userId) || !!buck.owners.find((o) => o.uuid === profile.userId))
.map(buck => ({
label: buck.name || t`Home`,
value: buck.id
}))
}
, [buckets, profile])
, [bucket, buckets, profile])

const hasNoSharedBucket = useMemo(() => bucketsOptions.length === 0, [bucketsOptions.length])

Expand Down

0 comments on commit 736b881

Please sign in to comment.