From 58492d9de79beaa63119fe8a45e719f3f910a6ee Mon Sep 17 00:00:00 2001 From: Guillaume Grossetie Date: Fri, 29 Sep 2023 14:25:29 +0200 Subject: [PATCH] Enregistre une nouvelle version quand on prend la main --- graphql/resolvers/articleResolver.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/graphql/resolvers/articleResolver.js b/graphql/resolvers/articleResolver.js index f08d4d9fc..ccc20d3d8 100644 --- a/graphql/resolvers/articleResolver.js +++ b/graphql/resolvers/articleResolver.js @@ -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!`) } } @@ -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) },