Merge pull request #16066 from overleaf/jdt-revert-ieee-fix

Revert #15976 (hiding theme picker on IEEE branded pages)

GitOrigin-RevId: 435a866a7e5ac105786f28dce0588d05cf504cd4
This commit is contained in:
Jimmy Domagala-Tang 2023-11-30 10:56:06 -05:00 committed by Copybot
parent cea7846795
commit 8e194d5ff9
4 changed files with 4 additions and 40 deletions

View file

@ -377,7 +377,6 @@ module.exports = function (webRouter, privateApiRouter, publicApiRouter) {
adminEmail: Settings.adminEmail,
dropboxAppName:
Settings.apis.thirdPartyDataStore?.dropboxAppName || 'Overleaf',
ieeeBrandId: IEEE_BRAND_ID,
hasSamlBeta: req.session.samlBeta,
hasAffiliationsFeature: Features.hasFeature('affiliations'),
hasSamlFeature: Features.hasFeature('saml'),

View file

@ -6,7 +6,6 @@ import SettingsMenuSelect, { Option } from './settings-menu-select'
import { useProjectSettingsContext } from '../../context/project-settings-context'
import type { OverallThemeMeta } from '../../../../../../types/project-settings'
import type { OverallTheme } from '../../../source-editor/extensions/theme'
import { ExposedSettings } from '../../../../../../types/exposed-settings'
export default function SettingsOverallTheme() {
const { t } = useTranslation()
@ -25,11 +24,10 @@ export default function SettingsOverallTheme() {
[overallThemes]
)
const brandVariation = getMeta('ol-brandVariation') as any
const { ieeeBrandId } = getMeta('ol-ExposedSettings') as ExposedSettings
const isIEEEBranded = brandVariation?.brand_id === ieeeBrandId
if (!overallThemes || isIEEEBranded) {
// TODO: check for IEEE brand by:
// - const brandVariation = getMeta('ol-brandVariation') as any[]
// - settings.overleaf != null && !isIEEE(brandVariation)
if (!overallThemes) {
return null
}

View file

@ -5,9 +5,6 @@ import SettingsOverallTheme from '../../../../../../frontend/js/features/editor-
import type { OverallThemeMeta } from '../../../../../../types/project-settings'
import { renderWithEditorContext } from '../../../../helpers/render-with-context'
const IEEE_BRAND_ID = 1234
const OTHER_BRAND_ID = 2234
describe('<SettingsOverallTheme />', function () {
const overallThemes: OverallThemeMeta[] = [
{
@ -24,9 +21,6 @@ describe('<SettingsOverallTheme />', function () {
beforeEach(function () {
window.metaAttributesCache.set('ol-overallThemes', overallThemes)
window.metaAttributesCache.set('ol-ExposedSettings', {
ieeeBrandId: IEEE_BRAND_ID,
})
})
afterEach(function () {
@ -44,30 +38,4 @@ describe('<SettingsOverallTheme />', function () {
expect(option.getAttribute('value')).to.equal(theme.val)
}
})
describe('Branded Project', function () {
it('should hide overall theme picker for IEEE branded projects', function () {
window.metaAttributesCache.set('ol-brandVariation', {
brand_id: IEEE_BRAND_ID,
})
renderWithEditorContext(<SettingsOverallTheme />)
const select = screen.queryByText('Overall theme')
expect(select).to.not.exist
})
it('should show overall theme picker for branded projects that are not IEEE', function () {
window.metaAttributesCache.set('ol-brandVariation', {
brand_id: OTHER_BRAND_ID,
})
renderWithEditorContext(<SettingsOverallTheme />)
const select = screen.getByLabelText('Overall theme')
expect(select).to.exist
})
it('should show overall theme picker for non branded projects', function () {
window.metaAttributesCache.set('ol-brandVariation', undefined)
renderWithEditorContext(<SettingsOverallTheme />)
const select = screen.getByLabelText('Overall theme')
expect(select).to.exist
})
})
})

View file

@ -19,7 +19,6 @@ export type ExposedSettings = {
hasLinkedProjectOutputFileFeature: boolean
hasSamlBeta?: boolean
hasSamlFeature: boolean
ieeeBrandId: number
isOverleaf: boolean
maxEntitiesPerProject: number
projectUploadTimeout: number