Skip to content

Commit

Permalink
Enregistre une nouvelle version quand on prend la main
Browse files Browse the repository at this point in the history
  • Loading branch information
ggrossetie committed Sep 29, 2023
1 parent a1894fa commit 58492d9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions graphql/resolvers/articleResolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,15 @@ async function createSoloSession (article, user, force = false) {
if (article.soloSession.creator._id.equals(user._id)) {
return article.soloSession
}
if (!force) {
if (force) {
await createVersion(article, {
major: false,
message: '',
userId: user._id,
type: 'editingSessionEnded'
}
)
} else {
throw new ApiError('UNAUTHORIZED_SOLO_SESSION_ACTIVE', `A solo session is already active!`)
}
}
Expand Down Expand Up @@ -448,8 +456,6 @@ module.exports = {
},

async takeOverSoloSession(article, _, { user }) {
// force!
// TODO: take over should save a new version of the article!
return createSoloSession(article, user, true)
},

Expand Down

0 comments on commit 58492d9

Please sign in to comment.