diff --git a/src/main/java/gov/cabinetoffice/gap/adminbackend/services/GrantAdvertService.java b/src/main/java/gov/cabinetoffice/gap/adminbackend/services/GrantAdvertService.java index 502b1e30..868556bf 100644 --- a/src/main/java/gov/cabinetoffice/gap/adminbackend/services/GrantAdvertService.java +++ b/src/main/java/gov/cabinetoffice/gap/adminbackend/services/GrantAdvertService.java @@ -328,6 +328,7 @@ public void unpublishAdvert(UUID advertId) { } advert.setStatus(GrantAdvertStatus.DRAFT); + advert.setContentfulSlug(null); advert.setUnpublishedDate(Instant.now()); save(advert); diff --git a/src/test/java/gov/cabinetoffice/gap/adminbackend/services/GrantAdvertServiceTest.java b/src/test/java/gov/cabinetoffice/gap/adminbackend/services/GrantAdvertServiceTest.java index f411e6c7..7ce06cb0 100644 --- a/src/test/java/gov/cabinetoffice/gap/adminbackend/services/GrantAdvertServiceTest.java +++ b/src/test/java/gov/cabinetoffice/gap/adminbackend/services/GrantAdvertServiceTest.java @@ -1067,6 +1067,7 @@ void unpublishAdvert_UnpublishesAdvertFromContentful_AndSetsStatusToDraftInDb() assertThat(advertCaptor.getValue().getId()).isEqualTo(grantAdvertId); assertThat(advertCaptor.getValue().getStatus()).isEqualTo(GrantAdvertStatus.DRAFT); assertThat(advertCaptor.getValue().getUnpublishedDate()).isNotNull(); + assertThat(advertCaptor.getValue().getContentfulSlug()).isNull(); } @Test @@ -1097,6 +1098,7 @@ void unpublishAdvertThroughLambda_successfullyUnpublishedAdvert() { assertThat(advertCaptor.getValue().getId()).isEqualTo(grantAdvertId); assertThat(advertCaptor.getValue().getStatus()).isEqualTo(GrantAdvertStatus.DRAFT); assertThat(advertCaptor.getValue().getUnpublishedDate()).isNotNull(); + assertThat(advertCaptor.getValue().getContentfulSlug()).isNull(); } }