Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #221 from mgilangjanuar/staging
Browse files Browse the repository at this point in the history
hotfix: get shared=1 in view page
  • Loading branch information
mgilangjanuar authored Jan 20, 2022
2 parents 1965430 + e9fd2c4 commit 1f08818
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions web/src/pages/View.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const View: React.FC<PageProps> = ({ match }) => {
const history = useHistory()
const { data, error, mutate } = useSWR(`/files/${match.params.id}`, fetcher)
const { data: user } = useSWRImmutable(data?.file ? `/users/${data.file.user_id}` : null, fetcher)
const { data: datafilesParts } = useSWR(data?.file.name && /\.part0*\d+$/.test(data.file.name) ? `/files?name.match=${encodeURIComponent('\.part0*[0-9]+$')}&name.like=${data.file.name.replace(/\.part0*\d+$/, '')}%&user_id=${data.file.user_id}&shared=1&parent_id${data.file.parent_id ? `=${data.file.parent_id}` : '.is=null'}` : null, fetcher)
const { data: datafilesParts } = useSWR(data?.file.name && /\.part0*\d+$/.test(data.file.name) ? `/files?name.match=${encodeURIComponent('\.part0*[0-9]+$')}&name.like=${data.file.name.replace(/\.part0*\d+$/, '')}%&user_id=${data.file.user_id}${me?.user.id !== data.file.user_id ? '&shared=1' : ''}&parent_id${data.file.parent_id ? `=${data.file.parent_id}` : '.is=null'}` : null, fetcher)
const [links, setLinks] = useState<{ raw: string, download: string, share: string }>()
const [showContent] = useDebounce(collapsed, 250)
const [contentStyle, setContentStyle] = useState<{ display: string } | undefined>()
Expand All @@ -87,7 +87,7 @@ const View: React.FC<PageProps> = ({ match }) => {
const [params, setParams] = useState<any>()
const [loading, setLoading] = useState<boolean>(false)
const [showDetails, setShowDetails] = useState<any>()
const { data: filesParts } = useSWR(showDetails ? `/files?name.match=${encodeURIComponent('\.part0*[0-9]+$')}&name.like=${showDetails.name.replace(/\.part0*\d+$/, '')}%&user_id=${showDetails.user_id}&shared=1&parent_id${showDetails.parent_id ? `=${showDetails.parent_id}` : '.is=null'}` : null, fetcher)
const { data: filesParts } = useSWR(showDetails ? `/files?name.match=${encodeURIComponent('\.part0*[0-9]+$')}&name.like=${showDetails.name.replace(/\.part0*\d+$/, '')}%&user_id=${showDetails.user_id}${me?.user.id !== showDetails.user_id ? '&shared=1' : ''}&parent_id${showDetails.parent_id ? `=${showDetails.parent_id}` : '.is=null'}` : null, fetcher)
const [popup, setPopup] = useState<{ visible: boolean, x?: number, y?: number, row?: any }>()
const { data: files, mutate: _refetch } = useSWR(data?.file.type === 'folder' && data?.file.sharing_options?.includes('*') && params ? `/files?name.notmatch=${encodeURIComponent('\.part0*[2-9]+$')}&${qs.stringify(params)}` : null, fetcher, { onSuccess: files => {
setLoading(false)
Expand Down Expand Up @@ -434,7 +434,7 @@ const View: React.FC<PageProps> = ({ match }) => {
<Layout.Sider width={320} trigger={null} collapsedWidth={0} breakpoint="lg" collapsed={collapsed} onCollapse={setCollapsed}>
<Layout.Content className="container" style={{ ...contentStyle || {}, color: '#fff', margin: '70px 10px' }}>
<Descriptions
title={<Typography.Text style={{ color: '#fff' }}><Icon type={data?.file.type} /> &nbsp; {data?.file.name}</Typography.Text>}
title={<Typography.Text style={{ color: '#fff' }}><Icon type={data?.file.type} /> &nbsp; {data?.file.name.replace(/\.part0*\d+$/, '')}</Typography.Text>}
contentStyle={{ color: '#fff' }}
labelStyle={{ color: '#fff' }} column={1}>

Expand Down

0 comments on commit 1f08818

Please sign in to comment.