mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
Merge pull request #28589 from overleaf/revert-28283-jdt-monthly-tl-experiment
Revert "Rolling TexLive builds experiment" GitOrigin-RevId: c3c6833dca7ef0d207f854c93bf0bb03bd814694
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import EditorLeftMenu from '../../../../frontend/js/features/editor-left-menu/components/editor-left-menu'
|
||||
import {
|
||||
ImageName,
|
||||
AllowedImageName,
|
||||
OverallThemeMeta,
|
||||
SpellCheckLanguage,
|
||||
} from '../../../../types/project-settings'
|
||||
@@ -35,22 +35,20 @@ describe('<EditorLeftMenu />', function () {
|
||||
},
|
||||
]
|
||||
|
||||
const ImageNames: ImageName[] = [
|
||||
const allowedImageNames: AllowedImageName[] = [
|
||||
{
|
||||
imageDesc: 'Image 1',
|
||||
imageName: 'img-1',
|
||||
allowed: true,
|
||||
},
|
||||
{
|
||||
imageDesc: 'Image 2',
|
||||
imageName: 'img-2',
|
||||
allowed: true,
|
||||
},
|
||||
]
|
||||
|
||||
beforeEach(function () {
|
||||
window.metaAttributesCache.set('ol-overallThemes', overallThemes)
|
||||
window.metaAttributesCache.set('ol-imageNames', ImageNames)
|
||||
window.metaAttributesCache.set('ol-allowedImageNames', allowedImageNames)
|
||||
window.metaAttributesCache.set('ol-anonymous', false)
|
||||
window.metaAttributesCache.set('ol-gitBridgeEnabled', true)
|
||||
window.metaAttributesCache.set('ol-showSupport', true)
|
||||
|
||||
+4
-6
@@ -2,26 +2,24 @@ import { screen, within, render } from '@testing-library/react'
|
||||
import { expect } from 'chai'
|
||||
import fetchMock from 'fetch-mock'
|
||||
import SettingsImageName from '../../../../../../frontend/js/features/editor-left-menu/components/settings/settings-image-name'
|
||||
import type { ImageName } from '../../../../../../types/project-settings'
|
||||
import type { AllowedImageName } from '../../../../../../types/project-settings'
|
||||
import { EditorLeftMenuProvider } from '@/features/editor-left-menu/components/editor-left-menu-context'
|
||||
import { EditorProviders } from '../../../../helpers/editor-providers'
|
||||
|
||||
describe('<SettingsImageName />', function () {
|
||||
const imageNames: ImageName[] = [
|
||||
const allowedImageNames: AllowedImageName[] = [
|
||||
{
|
||||
imageDesc: 'Image 1',
|
||||
imageName: 'img-1',
|
||||
allowed: true,
|
||||
},
|
||||
{
|
||||
imageDesc: 'Image 2',
|
||||
imageName: 'img-2',
|
||||
allowed: true,
|
||||
},
|
||||
]
|
||||
|
||||
beforeEach(function () {
|
||||
window.metaAttributesCache.set('ol-imageNames', imageNames)
|
||||
window.metaAttributesCache.set('ol-allowedImageNames', allowedImageNames)
|
||||
})
|
||||
|
||||
afterEach(function () {
|
||||
@@ -39,7 +37,7 @@ describe('<SettingsImageName />', function () {
|
||||
|
||||
const select = screen.getByLabelText('TeX Live version')
|
||||
|
||||
for (const { imageName, imageDesc } of imageNames) {
|
||||
for (const { imageName, imageDesc } of allowedImageNames) {
|
||||
const option = within(select).getByText(imageDesc)
|
||||
expect(option.getAttribute('value')).to.equal(imageName)
|
||||
}
|
||||
|
||||
@@ -4,12 +4,6 @@ const { ObjectId } = require('mongodb-legacy')
|
||||
|
||||
const MODULE_PATH = '../../../../app/src/Features/Project/ProjectHelper.js'
|
||||
|
||||
function _mapToAllowed(images) {
|
||||
return images.map(image => {
|
||||
return { imageName: image.imageName, allowed: image.allowed }
|
||||
})
|
||||
}
|
||||
|
||||
describe('ProjectHelper', function () {
|
||||
beforeEach(function () {
|
||||
this.project = {
|
||||
@@ -20,8 +14,6 @@ describe('ProjectHelper', function () {
|
||||
_id: '588f3ddae8ebc1bac07c9fa4',
|
||||
first_name: 'bjkdsjfk',
|
||||
features: {},
|
||||
labsProgram: true,
|
||||
labsExperiments: ['monthly-texlive'],
|
||||
}
|
||||
|
||||
this.adminUser = {
|
||||
@@ -40,11 +32,6 @@ describe('ProjectHelper', function () {
|
||||
imageDesc: 'TeX Live 2020',
|
||||
alphaOnly: true,
|
||||
},
|
||||
{
|
||||
imageName: 'texlive-full:2021.1',
|
||||
imageDesc: 'TeX Live 2021',
|
||||
monthlyExperimental: true,
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
@@ -141,58 +128,31 @@ describe('ProjectHelper', function () {
|
||||
})
|
||||
|
||||
describe('getAllowedImagesForUser', function () {
|
||||
it('marks alpha only images as not allowed when the user is anonymous', function () {
|
||||
it('filters out alpha-only images when the user is anonymous', function () {
|
||||
const images = this.ProjectHelper.getAllowedImagesForUser(null)
|
||||
const imageNames = _mapToAllowed(images)
|
||||
const imageNames = images.map(image => image.imageName)
|
||||
expect(imageNames).to.deep.equal([
|
||||
{ imageName: 'texlive-full:2018.1', allowed: true },
|
||||
{ imageName: 'texlive-full:2019.1', allowed: true },
|
||||
{ imageName: 'texlive-full:2020.1', allowed: false },
|
||||
{ imageName: 'texlive-full:2021.1', allowed: false },
|
||||
'texlive-full:2018.1',
|
||||
'texlive-full:2019.1',
|
||||
])
|
||||
})
|
||||
|
||||
it('marks monthly labs images as not allowed when the user is anonymous', function () {
|
||||
const images = this.ProjectHelper.getAllowedImagesForUser(null)
|
||||
const imageNames = _mapToAllowed(images)
|
||||
expect(imageNames).to.deep.equal([
|
||||
{ imageName: 'texlive-full:2018.1', allowed: true },
|
||||
{ imageName: 'texlive-full:2019.1', allowed: true },
|
||||
{ imageName: 'texlive-full:2020.1', allowed: false },
|
||||
{ imageName: 'texlive-full:2021.1', allowed: false },
|
||||
])
|
||||
})
|
||||
|
||||
it('marks monthly labs images as allowed when the user is enrolled', function () {
|
||||
it('filters out alpha-only images when the user is not admin', function () {
|
||||
const images = this.ProjectHelper.getAllowedImagesForUser(this.user)
|
||||
const imageNames = _mapToAllowed(images)
|
||||
const imageNames = images.map(image => image.imageName)
|
||||
expect(imageNames).to.deep.equal([
|
||||
{ imageName: 'texlive-full:2018.1', allowed: true },
|
||||
{ imageName: 'texlive-full:2019.1', allowed: true },
|
||||
{ imageName: 'texlive-full:2020.1', allowed: false },
|
||||
{ imageName: 'texlive-full:2021.1', allowed: true },
|
||||
])
|
||||
})
|
||||
|
||||
it('marks alpha only images as not allowed when when the user is not admin', function () {
|
||||
const images = this.ProjectHelper.getAllowedImagesForUser(this.user)
|
||||
const imageNames = _mapToAllowed(images)
|
||||
expect(imageNames).to.deep.equal([
|
||||
{ imageName: 'texlive-full:2018.1', allowed: true },
|
||||
{ imageName: 'texlive-full:2019.1', allowed: true },
|
||||
{ imageName: 'texlive-full:2020.1', allowed: false },
|
||||
{ imageName: 'texlive-full:2021.1', allowed: true },
|
||||
'texlive-full:2018.1',
|
||||
'texlive-full:2019.1',
|
||||
])
|
||||
})
|
||||
|
||||
it('returns all images when the user is admin', function () {
|
||||
const images = this.ProjectHelper.getAllowedImagesForUser(this.adminUser)
|
||||
const imageNames = _mapToAllowed(images)
|
||||
const imageNames = images.map(image => image.imageName)
|
||||
expect(imageNames).to.deep.equal([
|
||||
{ imageName: 'texlive-full:2018.1', allowed: true },
|
||||
{ imageName: 'texlive-full:2019.1', allowed: true },
|
||||
{ imageName: 'texlive-full:2020.1', allowed: true },
|
||||
{ imageName: 'texlive-full:2021.1', allowed: false },
|
||||
'texlive-full:2018.1',
|
||||
'texlive-full:2019.1',
|
||||
'texlive-full:2020.1',
|
||||
])
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user