diff --git a/services/web/frontend/js/features/editor-navigation-toolbar/components/editor-navigation-toolbar-root.js b/services/web/frontend/js/features/editor-navigation-toolbar/components/editor-navigation-toolbar-root.js index 8afb9e5e0a..1430a890a3 100644 --- a/services/web/frontend/js/features/editor-navigation-toolbar/components/editor-navigation-toolbar-root.js +++ b/services/web/frontend/js/features/editor-navigation-toolbar/components/editor-navigation-toolbar-root.js @@ -8,6 +8,9 @@ import { useProjectContext } from '../../../shared/context/project-context' const projectContextPropTypes = { name: PropTypes.string.isRequired, + features: PropTypes.shape({ + trackChangesVisible: PropTypes.bool, + }).isRequired, } const editorContextPropTypes = { @@ -41,7 +44,10 @@ const EditorNavigationToolbarRoot = React.memo( openDoc, openShareProjectModal, }) { - const { name: projectName } = useProjectContext(projectContextPropTypes) + const { + name: projectName, + features: { trackChangesVisible }, + } = useProjectContext(projectContextPropTypes) const { cobranding, @@ -132,6 +138,7 @@ const EditorNavigationToolbarRoot = React.memo( pdfViewIsOpen={view === 'pdf'} pdfButtonIsVisible={pdfLayout === 'flat'} togglePdfView={togglePdfView} + trackChangesVisible={trackChangesVisible} /> ) } diff --git a/services/web/frontend/js/features/editor-navigation-toolbar/components/toolbar-header.js b/services/web/frontend/js/features/editor-navigation-toolbar/components/toolbar-header.js index 02b12a6ab0..3deb5dd16e 100644 --- a/services/web/frontend/js/features/editor-navigation-toolbar/components/toolbar-header.js +++ b/services/web/frontend/js/features/editor-navigation-toolbar/components/toolbar-header.js @@ -36,8 +36,11 @@ const ToolbarHeader = React.memo(function ToolbarHeader({ pdfViewIsOpen, pdfButtonIsVisible, togglePdfView, + trackChangesVisible, }) { const shouldDisplayPublishButton = hasPublishPermissions && PublishButton + const shouldDisplayTrackChangesButton = + trackChangesVisible && !isRestrictedTokenMember return (
@@ -64,7 +67,7 @@ const ToolbarHeader = React.memo(function ToolbarHeader({
- {!isRestrictedTokenMember && ( + {shouldDisplayTrackChangesButton && ( {children} diff --git a/services/web/test/frontend/features/editor-navigation-toolbar/components/toolbar-header.test.js b/services/web/test/frontend/features/editor-navigation-toolbar/components/toolbar-header.test.js index a2a8cd9c43..ca612d1cf3 100644 --- a/services/web/test/frontend/features/editor-navigation-toolbar/components/toolbar-header.test.js +++ b/services/web/test/frontend/features/editor-navigation-toolbar/components/toolbar-header.test.js @@ -17,6 +17,7 @@ describe('', function () { openShareModal: () => {}, togglePdfView: () => {}, hasPublishPermissions: true, + trackChangesVisible: true, } describe('cobranding logo', function () { @@ -69,6 +70,15 @@ describe('', function () { render() expect(screen.queryByText('Review')).to.not.exist }) + + it('is not displayed when "trackChangesVisible" prop is set to false', function () { + const props = { + ...defaultProps, + trackChangesVisible: false, + } + render() + expect(screen.queryByText('Review')).to.not.exist + }) }) describe('History toggle button', function () {