mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-14 21:25:21 +00:00
[SP] Prevent rendering of sync section in SP when git disabled (#15647)
GitOrigin-RevId: 0f4c43eeb0182e7288566eff1ceed861bb9c4338
This commit is contained in:
parent
e0c8eb98c1
commit
42fe453096
5 changed files with 20 additions and 0 deletions
services/web
app
frontend
test/frontend/components/editor-left-menu
|
@ -906,6 +906,7 @@ const ProjectController = {
|
|||
brandVariation,
|
||||
allowedImageNames,
|
||||
gitBridgePublicBaseUrl: Settings.gitBridgePublicBaseUrl,
|
||||
gitBridgeEnabled: Features.hasFeature('git-bridge'),
|
||||
wsUrl,
|
||||
showSupport: Features.hasFeature('support'),
|
||||
showTemplatesServerPro,
|
||||
|
|
|
@ -11,6 +11,7 @@ meta(name="ol-isRestrictedTokenMember" data-type="boolean" content=isRestrictedT
|
|||
meta(name="ol-maxDocLength" data-type="json" content=maxDocLength)
|
||||
meta(name="ol-wikiEnabled" data-type="boolean" content=settings.proxyLearn)
|
||||
meta(name="ol-gitBridgePublicBaseUrl" content=gitBridgePublicBaseUrl)
|
||||
meta(name="ol-gitBridgeEnabled" data-type="boolean" content=gitBridgeEnabled)
|
||||
meta(name="ol-compilesUserContentDomain" content=settings.compilesUserContentDomain)
|
||||
meta(name="ol-fallbackCompileDomain" content=settings.pdfDownloadDomain)
|
||||
//- Set base path for Ace scripts loaded on demand/workers and don't use cdn
|
||||
|
|
|
@ -11,6 +11,7 @@ const components = importOverleafModules('editorLeftMenuSync') as {
|
|||
export default function SyncMenu() {
|
||||
const { t } = useTranslation()
|
||||
const anonymous = getMeta('ol-anonymous') as boolean | undefined
|
||||
const gitBridgeEnabled = getMeta('ol-gitBridgeEnabled', false) as boolean
|
||||
|
||||
if (anonymous === true || anonymous === undefined) {
|
||||
return null
|
||||
|
@ -20,6 +21,12 @@ export default function SyncMenu() {
|
|||
return null
|
||||
}
|
||||
|
||||
// This flag can only be false in CE and Server Pro. In this case we skip rendering the
|
||||
// entire sync section, since Dropbox and GitHub are never available in SP
|
||||
if (!gitBridgeEnabled) {
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<h4>{t('sync')}</h4>
|
||||
|
|
|
@ -10,6 +10,7 @@ export default {
|
|||
|
||||
export const WriteAccess = () => {
|
||||
window.metaAttributesCache.set('ol-anonymous', false)
|
||||
window.metaAttributesCache.set('ol-gitBridgeEnabled', true)
|
||||
useScope({
|
||||
permissionsLevel: 'owner',
|
||||
})
|
||||
|
@ -23,6 +24,7 @@ export const WriteAccess = () => {
|
|||
|
||||
export const ReadOnlyAccess = () => {
|
||||
window.metaAttributesCache.set('ol-anonymous', false)
|
||||
window.metaAttributesCache.set('ol-gitBridgeEnabled', true)
|
||||
useScope({
|
||||
permissionsLevel: 'readOnly',
|
||||
})
|
||||
|
|
|
@ -43,6 +43,7 @@ describe('<EditorLeftMenu />', function () {
|
|||
window.metaAttributesCache.set('ol-overallThemes', overallThemes)
|
||||
window.metaAttributesCache.set('ol-allowedImageNames', allowedImageNames)
|
||||
window.metaAttributesCache.set('ol-anonymous', false)
|
||||
window.metaAttributesCache.set('ol-gitBridgeEnabled', true)
|
||||
window.metaAttributesCache.set('ol-showSupport', true)
|
||||
window.metaAttributesCache.set('ol-user', {
|
||||
email: 'sherlock@holmes.co.uk',
|
||||
|
@ -319,6 +320,14 @@ describe('<EditorLeftMenu />', function () {
|
|||
cy.wait(['@user-status', '@project-status'])
|
||||
cy.findByText('Push to GitHub, pull to Overleaf')
|
||||
})
|
||||
|
||||
it('hides the entire sync section when git bridge is disabled', function () {
|
||||
window.metaAttributesCache.set('ol-gitBridgeEnabled', false)
|
||||
|
||||
cy.findByRole('button', { name: 'Dropbox' }).should('not.exist')
|
||||
cy.findByRole('button', { name: 'Git' }).should('not.exist')
|
||||
cy.findByRole('button', { name: 'GitHub' }).should('not.exist')
|
||||
})
|
||||
})
|
||||
|
||||
describe('settings menu', function () {
|
||||
|
|
Loading…
Add table
Reference in a new issue