Skip to content

Commit

Permalink
draft-api: Stop updating taxonomy metadata on unpublish
Browse files Browse the repository at this point in the history
  • Loading branch information
jnatten committed Nov 27, 2024
1 parent 238e2cb commit 5b104b2
Showing 1 changed file with 1 addition and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,7 @@ trait StateTransitionRules {
private[service] val unpublishArticle: SideEffect =
SideEffect.withDraftAndUser("unpublishArticle")((article: Draft, user: TokenUser) =>
doIfArticleIsNotInUse(article.id.getOrElse(1), user) {
article.id match {
case Some(id) =>
val taxMetadataT = taxonomyApiClient.updateTaxonomyMetadataIfExists(id, visible = false, user)
val articleUpdT = articleApiClient.unpublishArticle(article, user)
val failures = Seq(taxMetadataT, articleUpdT).collectFirst { case Failure(ex) => Failure(ex) }
failures.getOrElse(articleUpdT)
case _ => Failure(NotFoundException("This is a bug, article to unpublish has no id."))
}
articleApiClient.unpublishArticle(article, user)
}
)

Expand Down

0 comments on commit 5b104b2

Please sign in to comment.