From 3d7e3ba1f7be3d612de876ec5266140ae8208332 Mon Sep 17 00:00:00 2001 From: Jonas Natten Date: Wed, 22 Jan 2025 10:21:15 +0100 Subject: [PATCH] draft-api: Skip publishing roles when republishing a draft --- .../service/StateTransitionRules.scala | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/draft-api/src/main/scala/no/ndla/draftapi/service/StateTransitionRules.scala b/draft-api/src/main/scala/no/ndla/draftapi/service/StateTransitionRules.scala index ccd9bd087..056a65d03 100644 --- a/draft-api/src/main/scala/no/ndla/draftapi/service/StateTransitionRules.scala +++ b/draft-api/src/main/scala/no/ndla/draftapi/service/StateTransitionRules.scala @@ -139,54 +139,54 @@ trait StateTransitionRules { (IN_PROGRESS -> INTERNAL_REVIEW) keepCurrentOnTransition, (IN_PROGRESS -> QUALITY_ASSURANCE) .require(PublishRoles, articleHasBeenPublished) keepStates Set(PUBLISHED), (IN_PROGRESS -> LANGUAGE) .require(PublishRoles, articleHasBeenPublished) keepStates Set(PUBLISHED), - (IN_PROGRESS -> PUBLISHED) require DirectPublishRoles withSideEffect publishWithSoftValidation withSideEffect resetResponsible, + (IN_PROGRESS -> PUBLISHED) .require(DirectPublishRoles, articleHasBeenPublished) withSideEffect publishWithSoftValidation withSideEffect resetResponsible, (IN_PROGRESS -> ARCHIVED) .require(PublishRoles, articleHasNotBeenPublished) withIllegalStatuses Set(PUBLISHED) withSideEffect resetResponsible, (IN_PROGRESS -> REPUBLISH) .require(PublishRoles, articleHasBeenPublished) keepStates Set(PUBLISHED) requireStatusesForTransition Set(PUBLISHED), EXTERNAL_REVIEW -> IN_PROGRESS keepStates Set(PUBLISHED), (EXTERNAL_REVIEW -> EXTERNAL_REVIEW) keepStates Set(IN_PROGRESS, PUBLISHED), (EXTERNAL_REVIEW -> INTERNAL_REVIEW) keepStates Set(PUBLISHED) keepCurrentOnTransition, - (EXTERNAL_REVIEW -> PUBLISHED) require DirectPublishRoles withSideEffect publishWithSoftValidation withSideEffect resetResponsible, + (EXTERNAL_REVIEW -> PUBLISHED) .require(DirectPublishRoles, articleHasBeenPublished) withSideEffect publishWithSoftValidation withSideEffect resetResponsible, (EXTERNAL_REVIEW -> ARCHIVED) .require(PublishRoles, articleHasNotBeenPublished) withIllegalStatuses Set(PUBLISHED) withSideEffect resetResponsible, INTERNAL_REVIEW -> IN_PROGRESS, (INTERNAL_REVIEW -> EXTERNAL_REVIEW) keepStates Set(INTERNAL_REVIEW, PUBLISHED), INTERNAL_REVIEW -> INTERNAL_REVIEW, (INTERNAL_REVIEW -> QUALITY_ASSURANCE) keepCurrentOnTransition, - (INTERNAL_REVIEW -> PUBLISHED) require DirectPublishRoles withSideEffect publishWithSoftValidation withSideEffect resetResponsible, + (INTERNAL_REVIEW -> PUBLISHED) .require(DirectPublishRoles, articleHasBeenPublished) withSideEffect publishWithSoftValidation withSideEffect resetResponsible, (INTERNAL_REVIEW -> ARCHIVED) .require(PublishRoles, articleHasNotBeenPublished) withIllegalStatuses Set(PUBLISHED) withSideEffect resetResponsible, (QUALITY_ASSURANCE -> IN_PROGRESS) keepStates Set(PUBLISHED), (QUALITY_ASSURANCE -> INTERNAL_REVIEW) keepStates Set(PUBLISHED), QUALITY_ASSURANCE -> QUALITY_ASSURANCE, (QUALITY_ASSURANCE -> LANGUAGE) keepStates Set(PUBLISHED) require DirectPublishRoles, (QUALITY_ASSURANCE -> ARCHIVED) .require(PublishRoles, articleHasNotBeenPublished) withIllegalStatuses Set(PUBLISHED) withSideEffect resetResponsible, - (QUALITY_ASSURANCE -> PUBLISHED) require PublishRoles withSideEffect publishArticle withSideEffect resetResponsible, + (QUALITY_ASSURANCE -> PUBLISHED) .require(PublishRoles, articleHasBeenPublished) withSideEffect publishArticle withSideEffect resetResponsible, LANGUAGE -> IN_PROGRESS, (LANGUAGE -> QUALITY_ASSURANCE) keepCurrentOnTransition, LANGUAGE -> LANGUAGE, (LANGUAGE -> FOR_APPROVAL) keepStates Set(PUBLISHED) require DirectPublishRoles, - (LANGUAGE -> PUBLISHED) require PublishRoles withSideEffect publishArticle withSideEffect resetResponsible, + (LANGUAGE -> PUBLISHED) .require(PublishRoles, articleHasBeenPublished) withSideEffect publishArticle withSideEffect resetResponsible, (LANGUAGE -> ARCHIVED) .require(PublishRoles, articleHasNotBeenPublished) withIllegalStatuses Set(PUBLISHED) withSideEffect resetResponsible, (FOR_APPROVAL -> IN_PROGRESS) keepStates Set(PUBLISHED), (FOR_APPROVAL -> LANGUAGE) keepStates Set(PUBLISHED), FOR_APPROVAL -> FOR_APPROVAL, (FOR_APPROVAL -> END_CONTROL) keepStates Set(PUBLISHED) withSideEffect validateArticleApiArticle, - (FOR_APPROVAL -> PUBLISHED) require PublishRoles withSideEffect publishArticle withSideEffect resetResponsible, + (FOR_APPROVAL -> PUBLISHED) .require(PublishRoles, articleHasBeenPublished) withSideEffect publishArticle withSideEffect resetResponsible, (FOR_APPROVAL -> ARCHIVED) .require(PublishRoles, articleHasNotBeenPublished) withIllegalStatuses Set(PUBLISHED) withSideEffect resetResponsible, (END_CONTROL -> IN_PROGRESS) keepStates Set(PUBLISHED), (END_CONTROL -> FOR_APPROVAL) keepStates Set(PUBLISHED), (END_CONTROL -> END_CONTROL) withSideEffect validateArticleApiArticle, (END_CONTROL -> PUBLISH_DELAYED) require DirectPublishRoles withSideEffect validateArticleApiArticle, - (END_CONTROL -> PUBLISHED) require DirectPublishRoles withSideEffect publishArticle withSideEffect resetResponsible, + (END_CONTROL -> PUBLISHED) .require(DirectPublishRoles, articleHasBeenPublished) withSideEffect publishArticle withSideEffect resetResponsible, (END_CONTROL -> ARCHIVED) .require(PublishRoles, articleHasNotBeenPublished) withIllegalStatuses Set(PUBLISHED) withSideEffect resetResponsible, (PUBLISH_DELAYED -> END_CONTROL) keepStates Set(PUBLISHED) withSideEffect validateArticleApiArticle, PUBLISH_DELAYED -> PUBLISH_DELAYED, - (PUBLISH_DELAYED -> PUBLISHED) require DirectPublishRoles withSideEffect publishArticle withSideEffect resetResponsible, + (PUBLISH_DELAYED -> PUBLISHED) .require(DirectPublishRoles, articleHasBeenPublished) withSideEffect publishArticle withSideEffect resetResponsible, (PUBLISH_DELAYED -> ARCHIVED) .require(PublishRoles, articleHasNotBeenPublished) withIllegalStatuses Set(PUBLISHED) withSideEffect resetResponsible, (PUBLISHED -> IN_PROGRESS) keepStates Set(PUBLISHED) withSideEffect addResponsible keepCurrentOnTransition, (PUBLISHED -> UNPUBLISHED) keepStates Set.empty require DirectPublishRoles withSideEffect unpublishArticle withSideEffect resetResponsible, (PUBLISHED -> ARCHIVED) .require(PublishRoles, articleHasNotBeenPublished) withIllegalStatuses Set(PUBLISHED) withSideEffect unpublishArticle withSideEffect resetResponsible, REPUBLISH -> REPUBLISH, REPUBLISH -> IN_PROGRESS keepStates Set(PUBLISHED), - (REPUBLISH -> PUBLISHED) require PublishRoles withSideEffect publishArticle withSideEffect resetResponsible, + (REPUBLISH -> PUBLISHED) .require(PublishRoles, articleHasBeenPublished) withSideEffect publishArticle withSideEffect resetResponsible, UNPUBLISHED -> UNPUBLISHED withSideEffect resetResponsible, (UNPUBLISHED -> PUBLISHED) require DirectPublishRoles withSideEffect publishWithSoftValidation withSideEffect resetResponsible, UNPUBLISHED -> IN_PROGRESS,