mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-02 15:34:51 +00:00
Merge pull request #4043 from overleaf/as-clean-up-exposed-settings
Remove `exposedSettings` from `ApplicationContext` GitOrigin-RevId: 02acd3a7cf36d184560ff6df13acff515da908fa
This commit is contained in:
parent
03b2d184b5
commit
70952906c9
9 changed files with 8 additions and 39 deletions
|
@ -3,7 +3,6 @@ import PropTypes from 'prop-types'
|
|||
import { useTranslation } from 'react-i18next'
|
||||
import PreviewLogsPaneEntry from './preview-logs-pane-entry'
|
||||
import Icon from '../../../shared/components/icon'
|
||||
import { useApplicationContext } from '../../../shared/context/application-context'
|
||||
import { useEditorContext } from '../../../shared/context/editor-context'
|
||||
import StartFreeTrialButton from '../../../shared/components/start-free-trial-button'
|
||||
|
||||
|
@ -11,12 +10,6 @@ function PreviewError({ name }) {
|
|||
const { hasPremiumCompile, isProjectOwner } = useEditorContext({
|
||||
isProjectOwner: PropTypes.bool,
|
||||
})
|
||||
const {
|
||||
exposedSettings: { enableSubscriptions },
|
||||
} = useApplicationContext({
|
||||
exposedSettings: PropTypes.shape({ enableSubscriptions: PropTypes.bool })
|
||||
.isRequired,
|
||||
})
|
||||
|
||||
const { t } = useTranslation()
|
||||
let errorTitle
|
||||
|
@ -74,7 +67,9 @@ function PreviewError({ name }) {
|
|||
entryAriaLabel={t('compile_error_entry_description')}
|
||||
level="error"
|
||||
/>
|
||||
{name === 'timedout' && enableSubscriptions && !hasPremiumCompile ? (
|
||||
{name === 'timedout' &&
|
||||
window.ExposedSettings.enableSubscriptions &&
|
||||
!hasPremiumCompile ? (
|
||||
<TimeoutUpgradePrompt isProjectOwner={isProjectOwner} />
|
||||
) : null}
|
||||
</>
|
||||
|
|
|
@ -60,7 +60,6 @@ import './services/wait-for'
|
|||
import './filters/formatDate'
|
||||
import './main/event'
|
||||
import './main/account-upgrade-angular'
|
||||
import './main/exposed-settings-angular'
|
||||
import './main/system-messages'
|
||||
import '../../modules/modules-ide.js'
|
||||
import './shared/context/controllers/root-context-controller'
|
||||
|
|
|
@ -28,7 +28,6 @@ import './main/register-users'
|
|||
import './main/subscription/team-invite-controller'
|
||||
import './main/subscription/upgrade-subscription'
|
||||
import './main/learn'
|
||||
import './main/exposed-settings-angular'
|
||||
import './main/affiliations/components/affiliationForm'
|
||||
import './main/affiliations/components/inputSuggestions'
|
||||
import './main/affiliations/controllers/UserAffiliationsController'
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
import App from '../base'
|
||||
|
||||
App.constant('ExposedSettings', window.ExposedSettings)
|
|
@ -10,10 +10,6 @@ ApplicationContext.Provider.propTypes = {
|
|||
firstName: PropTypes.string,
|
||||
lastName: PropTypes.string,
|
||||
}),
|
||||
exposedSettings: PropTypes.shape({
|
||||
appName: PropTypes.string.isRequired,
|
||||
enableSubscriptions: PropTypes.bool,
|
||||
}),
|
||||
gitBridgePublicBaseUrl: PropTypes.string.isRequired,
|
||||
}),
|
||||
}
|
||||
|
@ -21,7 +17,6 @@ ApplicationContext.Provider.propTypes = {
|
|||
export function ApplicationProvider({ children }) {
|
||||
const applicationContextValue = {
|
||||
user: window.user,
|
||||
exposedSettings: window.ExposedSettings,
|
||||
gitBridgePublicBaseUrl: window.gitBridgePublicBaseUrl,
|
||||
}
|
||||
return (
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import React, { createContext, useCallback, useContext, useEffect } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import useScopeValue from './util/scope-value-hook'
|
||||
import { useApplicationContext } from './application-context'
|
||||
import useBrowserWindow from '../hooks/use-browser-window'
|
||||
|
||||
export const EditorContext = createContext()
|
||||
|
@ -32,13 +31,6 @@ EditorContext.Provider.propTypes = {
|
|||
}
|
||||
|
||||
export function EditorProvider({ children, ide, settings }) {
|
||||
const {
|
||||
exposedSettings: { appName },
|
||||
} = useApplicationContext({
|
||||
exposedSettings: PropTypes.shape({ appName: PropTypes.string.isRequired })
|
||||
.isRequired,
|
||||
})
|
||||
|
||||
const cobranding = window.brandVariation
|
||||
? {
|
||||
logoImgUrl: window.brandVariation.logo_url,
|
||||
|
@ -100,9 +92,11 @@ export function EditorProvider({ children, ide, settings }) {
|
|||
const { setTitle } = useBrowserWindow()
|
||||
useEffect(() => {
|
||||
setTitle(
|
||||
`${projectName ? projectName + ' - ' : ''}Online LaTeX Editor ${appName}`
|
||||
`${projectName ? projectName + ' - ' : ''}Online LaTeX Editor ${
|
||||
window.ExposedSettings.appName
|
||||
}`
|
||||
)
|
||||
}, [appName, projectName, setTitle])
|
||||
}, [projectName, setTitle])
|
||||
|
||||
const editorContextValue = {
|
||||
cobranding,
|
||||
|
|
1
services/web/test/frontend/bootstrap.js
vendored
1
services/web/test/frontend/bootstrap.js
vendored
|
@ -22,6 +22,7 @@ window.ExposedSettings = {
|
|||
appName: 'Overleaf',
|
||||
maxEntitiesPerProject: 10,
|
||||
maxUploadSize: 5 * 1024 * 1024,
|
||||
siteUrl: 'https://www.dev-overleaf.com',
|
||||
}
|
||||
|
||||
window.i18n = { currentLangCode: 'en' }
|
||||
|
|
|
@ -86,16 +86,6 @@ describe('<ShareProjectModal/>', function () {
|
|||
handleHide: sinon.stub(),
|
||||
}
|
||||
|
||||
const originalExposedSettings = window.ExposedSettings
|
||||
|
||||
before(function () {
|
||||
window.ExposedSettings = { appName: 'Overleaf' }
|
||||
})
|
||||
|
||||
after(function () {
|
||||
window.ExposedSettings = originalExposedSettings
|
||||
})
|
||||
|
||||
beforeEach(function () {
|
||||
fetchMock.get('/user/contacts', { contacts })
|
||||
})
|
||||
|
|
|
@ -19,7 +19,6 @@ export function EditorProviders({
|
|||
children,
|
||||
}) {
|
||||
window.user = user || window.user
|
||||
window.ExposedSettings.appName = 'test'
|
||||
window.gitBridgePublicBaseUrl = 'git.overleaf.test'
|
||||
window.project_id = projectId != null ? projectId : window.project_id
|
||||
|
||||
|
|
Loading…
Reference in a new issue