mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #4675 from overleaf/msm-fix-review-button-ce
Remove Track Changes button in CE GitOrigin-RevId: 7e682ea9cce8d23ba0fffc95cfb379588f0fd42e
This commit is contained in:
parent
1fb1c08348
commit
4737982cdd
4 changed files with 26 additions and 5 deletions
|
@ -8,6 +8,9 @@ import { useProjectContext } from '../../../shared/context/project-context'
|
||||||
|
|
||||||
const projectContextPropTypes = {
|
const projectContextPropTypes = {
|
||||||
name: PropTypes.string.isRequired,
|
name: PropTypes.string.isRequired,
|
||||||
|
features: PropTypes.shape({
|
||||||
|
trackChangesVisible: PropTypes.bool,
|
||||||
|
}).isRequired,
|
||||||
}
|
}
|
||||||
|
|
||||||
const editorContextPropTypes = {
|
const editorContextPropTypes = {
|
||||||
|
@ -41,7 +44,10 @@ const EditorNavigationToolbarRoot = React.memo(
|
||||||
openDoc,
|
openDoc,
|
||||||
openShareProjectModal,
|
openShareProjectModal,
|
||||||
}) {
|
}) {
|
||||||
const { name: projectName } = useProjectContext(projectContextPropTypes)
|
const {
|
||||||
|
name: projectName,
|
||||||
|
features: { trackChangesVisible },
|
||||||
|
} = useProjectContext(projectContextPropTypes)
|
||||||
|
|
||||||
const {
|
const {
|
||||||
cobranding,
|
cobranding,
|
||||||
|
@ -132,6 +138,7 @@ const EditorNavigationToolbarRoot = React.memo(
|
||||||
pdfViewIsOpen={view === 'pdf'}
|
pdfViewIsOpen={view === 'pdf'}
|
||||||
pdfButtonIsVisible={pdfLayout === 'flat'}
|
pdfButtonIsVisible={pdfLayout === 'flat'}
|
||||||
togglePdfView={togglePdfView}
|
togglePdfView={togglePdfView}
|
||||||
|
trackChangesVisible={trackChangesVisible}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,8 +36,11 @@ const ToolbarHeader = React.memo(function ToolbarHeader({
|
||||||
pdfViewIsOpen,
|
pdfViewIsOpen,
|
||||||
pdfButtonIsVisible,
|
pdfButtonIsVisible,
|
||||||
togglePdfView,
|
togglePdfView,
|
||||||
|
trackChangesVisible,
|
||||||
}) {
|
}) {
|
||||||
const shouldDisplayPublishButton = hasPublishPermissions && PublishButton
|
const shouldDisplayPublishButton = hasPublishPermissions && PublishButton
|
||||||
|
const shouldDisplayTrackChangesButton =
|
||||||
|
trackChangesVisible && !isRestrictedTokenMember
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<header className="toolbar toolbar-header toolbar-with-labels">
|
<header className="toolbar toolbar-header toolbar-with-labels">
|
||||||
|
@ -64,7 +67,7 @@ const ToolbarHeader = React.memo(function ToolbarHeader({
|
||||||
<div className="toolbar-right">
|
<div className="toolbar-right">
|
||||||
<OnlineUsersWidget onlineUsers={onlineUsers} goToUser={goToUser} />
|
<OnlineUsersWidget onlineUsers={onlineUsers} goToUser={goToUser} />
|
||||||
|
|
||||||
{!isRestrictedTokenMember && (
|
{shouldDisplayTrackChangesButton && (
|
||||||
<TrackChangesToggleButton
|
<TrackChangesToggleButton
|
||||||
onClick={toggleReviewPanelOpen}
|
onClick={toggleReviewPanelOpen}
|
||||||
disabled={historyIsOpen}
|
disabled={historyIsOpen}
|
||||||
|
@ -114,6 +117,7 @@ ToolbarHeader.propTypes = {
|
||||||
pdfViewIsOpen: PropTypes.bool,
|
pdfViewIsOpen: PropTypes.bool,
|
||||||
pdfButtonIsVisible: PropTypes.bool,
|
pdfButtonIsVisible: PropTypes.bool,
|
||||||
togglePdfView: PropTypes.func.isRequired,
|
togglePdfView: PropTypes.func.isRequired,
|
||||||
|
trackChangesVisible: PropTypes.bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ToolbarHeader
|
export default ToolbarHeader
|
||||||
|
|
|
@ -21,8 +21,8 @@ ProjectContext.Provider.propTypes = {
|
||||||
),
|
),
|
||||||
features: PropTypes.shape({
|
features: PropTypes.shape({
|
||||||
collaborators: PropTypes.number,
|
collaborators: PropTypes.number,
|
||||||
compileGroup: PropTypes.oneOf(['alpha', 'standard', 'priority'])
|
compileGroup: PropTypes.oneOf(['alpha', 'standard', 'priority']),
|
||||||
.isRequired,
|
trackChangesVisible: PropTypes.bool,
|
||||||
}),
|
}),
|
||||||
publicAccesLevel: PropTypes.string,
|
publicAccesLevel: PropTypes.string,
|
||||||
tokens: PropTypes.shape({
|
tokens: PropTypes.shape({
|
||||||
|
@ -60,7 +60,7 @@ export function ProjectProvider({ children }) {
|
||||||
|
|
||||||
// when the provider is created the project is still not added to the Angular scope.
|
// when the provider is created the project is still not added to the Angular scope.
|
||||||
// Name is also populated to prevent errors in existing React components
|
// Name is also populated to prevent errors in existing React components
|
||||||
const value = project || { _id: window.project_id, name: '' }
|
const value = project || { _id: window.project_id, name: '', features: {} }
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ProjectContext.Provider value={value}>{children}</ProjectContext.Provider>
|
<ProjectContext.Provider value={value}>{children}</ProjectContext.Provider>
|
||||||
|
|
|
@ -17,6 +17,7 @@ describe('<ToolbarHeader />', function () {
|
||||||
openShareModal: () => {},
|
openShareModal: () => {},
|
||||||
togglePdfView: () => {},
|
togglePdfView: () => {},
|
||||||
hasPublishPermissions: true,
|
hasPublishPermissions: true,
|
||||||
|
trackChangesVisible: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('cobranding logo', function () {
|
describe('cobranding logo', function () {
|
||||||
|
@ -69,6 +70,15 @@ describe('<ToolbarHeader />', function () {
|
||||||
render(<ToolbarHeader {...props} />)
|
render(<ToolbarHeader {...props} />)
|
||||||
expect(screen.queryByText('Review')).to.not.exist
|
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(<ToolbarHeader {...props} />)
|
||||||
|
expect(screen.queryByText('Review')).to.not.exist
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('History toggle button', function () {
|
describe('History toggle button', function () {
|
||||||
|
|
Loading…
Reference in a new issue