mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-04 06:39:02 +02:00
Merge pull request #16073 from overleaf/em-postpone-tutorials
Support postponing tutorials GitOrigin-RevId: fe662086c87cc1909d6d9eeac07f85e306d64418
This commit is contained in:
@@ -5,6 +5,7 @@ const { expressify } = require('@overleaf/promise-utils')
|
||||
const VALID_KEYS = [
|
||||
'react-history-buttons-tutorial',
|
||||
'table-generator-promotion',
|
||||
'writefull-integration',
|
||||
]
|
||||
|
||||
async function completeTutorial(req, res, next) {
|
||||
@@ -12,13 +13,26 @@ async function completeTutorial(req, res, next) {
|
||||
const tutorialKey = req.params.tutorialKey
|
||||
|
||||
if (!VALID_KEYS.includes(tutorialKey)) {
|
||||
return res.sendStatus(400)
|
||||
return res.sendStatus(404)
|
||||
}
|
||||
|
||||
await TutorialHandler.saveCompletion(userId, tutorialKey)
|
||||
await TutorialHandler.setTutorialState(userId, tutorialKey, 'completed')
|
||||
res.sendStatus(204)
|
||||
}
|
||||
|
||||
async function postponeTutorial(req, res, next) {
|
||||
const userId = SessionManager.getLoggedInUserId(req.session)
|
||||
const tutorialKey = req.params.tutorialKey
|
||||
|
||||
if (!VALID_KEYS.includes(tutorialKey)) {
|
||||
return res.sendStatus(404)
|
||||
}
|
||||
|
||||
await TutorialHandler.setTutorialState(userId, tutorialKey, 'postponed')
|
||||
res.sendStatus(204)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
completeTutorial: expressify(completeTutorial),
|
||||
postponeTutorial: expressify(postponeTutorial),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user