mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #17318 from overleaf/jpa-create-tokens-first
[web] create link-sharing tokens before enabling link-sharing GitOrigin-RevId: 19a72d57623421681f0de3193572b916a5adeaa9
This commit is contained in:
parent
346ad10d2e
commit
642eea2de6
1 changed files with 25 additions and 18 deletions
|
@ -568,24 +568,31 @@ const EditorController = {
|
|||
},
|
||||
|
||||
setPublicAccessLevel(projectId, newAccessLevel, callback) {
|
||||
ProjectDetailsHandler.setPublicAccessLevel(
|
||||
projectId,
|
||||
newAccessLevel,
|
||||
function (err) {
|
||||
if (err) {
|
||||
return callback(err)
|
||||
}
|
||||
EditorRealTimeController.emitToRoom(
|
||||
projectId,
|
||||
'project:publicAccessLevel:changed',
|
||||
{ newAccessLevel }
|
||||
)
|
||||
if (newAccessLevel === PublicAccessLevels.TOKEN_BASED) {
|
||||
ProjectDetailsHandler.ensureTokensArePresent(projectId, callback)
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
async.series(
|
||||
[
|
||||
cb => {
|
||||
if (newAccessLevel === PublicAccessLevels.TOKEN_BASED) {
|
||||
ProjectDetailsHandler.ensureTokensArePresent(projectId, cb)
|
||||
} else {
|
||||
cb()
|
||||
}
|
||||
},
|
||||
cb =>
|
||||
ProjectDetailsHandler.setPublicAccessLevel(
|
||||
projectId,
|
||||
newAccessLevel,
|
||||
cb
|
||||
),
|
||||
cb => {
|
||||
EditorRealTimeController.emitToRoom(
|
||||
projectId,
|
||||
'project:publicAccessLevel:changed',
|
||||
{ newAccessLevel }
|
||||
)
|
||||
cb()
|
||||
},
|
||||
],
|
||||
callback
|
||||
)
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue