Skip to content

Commit

Permalink
fix: Actually load domain type config
Browse files Browse the repository at this point in the history
  • Loading branch information
y-lohse committed Jul 28, 2020
1 parent 28cd3cd commit 6bda32e
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/drive/web/modules/views/Folder/FolderViewBody.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import React, { useCallback, useContext } from 'react'
import get from 'lodash/get'

import { ThumbnailSizeContext } from 'drive/lib/ThumbnailSizeContext'
import { models, useClient, Q, generateWebLink } from 'cozy-client'
import {
models,
useClient,
Q,
generateWebLink,
useCapabilities
} from 'cozy-client'
import { useDispatch } from 'react-redux'
import Alerter from 'cozy-ui/transpiled/react/Alerter'

Expand Down Expand Up @@ -56,6 +63,7 @@ const FolderViewBody = ({
navigateToFile,
refreshFolderContent = null
}) => {
const client = useClient()
const { isBigThumbnail, toggleThumbnailSize } = useContext(
ThumbnailSizeContext
)
Expand All @@ -65,8 +73,13 @@ const FolderViewBody = ({
setSortOrder({ sortAttribute: attribute, sortOrder: order })
)

const capabilities = useCapabilities(client)
const isFlatDomain = get(
capabilities,
'capabilities.data.attributes.flat_subdomains'
)

const dispatch = useDispatch()
const client = useClient()

const handleFileOpen = useCallback(
async (file, availableOffline) => {
Expand All @@ -88,7 +101,7 @@ const FolderViewBody = ({
Alerter.error('alert.could_not_open_file')
}
} else {
const url = generateFileUrl({ file, client, isFlatDomain: true })
const url = generateFileUrl({ file, client, isFlatDomain })
window.open(url, '_blank')
}
} else if (isNote) {
Expand Down

0 comments on commit 6bda32e

Please sign in to comment.