Merge pull request #5275 from overleaf/jpa-hide-refresh-linked-file-for-read-only

[web] hide refresh linked file button for readOnly users

GitOrigin-RevId: 02ae9805259181d66c69301e7b0a0b5fe3cdf7a0
This commit is contained in:
Jakob Ackermann 2021-09-29 11:05:12 +02:00 committed by Copybot
parent 2a935d7ab5
commit 4b0e85f340

View file

@ -5,6 +5,7 @@ import { Trans, useTranslation } from 'react-i18next'
import Icon from '../../../shared/components/icon'
import { formatTime, relativeDate } from '../../utils/format-date'
import { postJSON } from '../../../infrastructure/fetch-json'
import { useEditorContext } from '../../../shared/context/editor-context'
import { useProjectContext } from '../../../shared/context/project-context'
import importOverleafModules from '../../../../macros/import-overleaf-module.macro'
@ -35,6 +36,9 @@ export default function FileViewHeader({ file, storeReferencesKeys }) {
const { _id: projectId } = useProjectContext({
_id: PropTypes.string.isRequired,
})
const { permissionsLevel } = useEditorContext({
permissionsLevel: PropTypes.string.isRequired,
})
const { t } = useTranslation()
const [refreshing, setRefreshing] = useState(false)
@ -110,7 +114,7 @@ export default function FileViewHeader({ file, storeReferencesKeys }) {
tprLinkedFileInfo.map(({ import: { LinkedFileInfo }, path }) => (
<LinkedFileInfo key={path} file={file} />
))}
{file.linkedFileData && (
{file.linkedFileData && permissionsLevel !== 'readOnly' && (
<button
className="btn btn-success"
onClick={refreshFile}