mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02:00
Merge pull request #8886 from overleaf/jpa-pdf-caching-alpha
[web] prepare alpha release of pdf caching GitOrigin-RevId: 5617dd443da57b7077db793c2bc39be35ec44ef1
This commit is contained in:
@@ -983,6 +983,18 @@ const ProjectController = {
|
||||
}
|
||||
)
|
||||
},
|
||||
trackPdfDownloadAssignment(cb) {
|
||||
SplitTestHandler.getAssignment(req, res, 'track-pdf-download', () => {
|
||||
// We'll pick up the assignment from the res.locals assignment.
|
||||
cb()
|
||||
})
|
||||
},
|
||||
pdfCachingModeAssignment(cb) {
|
||||
SplitTestHandler.getAssignment(req, res, 'pdf-caching-mode', () => {
|
||||
// We'll pick up the assignment from the res.locals assignment.
|
||||
cb()
|
||||
})
|
||||
},
|
||||
},
|
||||
(
|
||||
err,
|
||||
@@ -1071,30 +1083,6 @@ const ProjectController = {
|
||||
}
|
||||
}
|
||||
|
||||
function getTrackPdfDownload() {
|
||||
if (!Settings.enablePdfCaching) {
|
||||
// The feature is disabled globally.
|
||||
return false
|
||||
}
|
||||
// Let the user opt-in only.
|
||||
// The flag will opt-out of both caching and metrics collection,
|
||||
// as if this editing session never happened.
|
||||
return shouldDisplayFeature('track-pdf-download', false)
|
||||
}
|
||||
|
||||
function getPdfCachingMode() {
|
||||
if (!Settings.enablePdfCaching) {
|
||||
// The feature is disabled globally.
|
||||
return ''
|
||||
}
|
||||
// Let the user opt-in only.
|
||||
const v = req.query['pdf-caching-mode']
|
||||
if (['enabled'].includes(v)) {
|
||||
return v
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
const showPdfDetach = shouldDisplayFeature(
|
||||
'pdf_detach',
|
||||
pdfDetachAssignment.variant === 'enabled'
|
||||
@@ -1199,8 +1187,6 @@ const ProjectController = {
|
||||
showNewSourceEditorOption,
|
||||
showSymbolPalette,
|
||||
showStopOnFirstError,
|
||||
trackPdfDownload: getTrackPdfDownload(),
|
||||
pdfCachingMode: getPdfCachingMode(),
|
||||
detachRole,
|
||||
metadata: { viewport: false },
|
||||
showHeaderUpgradePrompt,
|
||||
|
||||
Reference in New Issue
Block a user