Skip to content

Commit

Permalink
Merge pull request #4291 from guardian/remove-new-persistence-reason
Browse files Browse the repository at this point in the history
[reaper] remove the recently added persistence reason 'collection' as existing 'persisted-collection' reason is fine
  • Loading branch information
twrichards authored Jun 25, 2024
2 parents be80ea0 + 890883b commit f658ba2
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 8 deletions.
2 changes: 0 additions & 2 deletions kahuna/public/js/services/image-logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ imageLogic.factory('imageLogic', ['imageAccessor', function(imageAccessor) {
return 'categorised as agency commissioned';
case 'persisted-collection':
return 'added to a persisted collection';
case 'collection':
return 'added to a collection';
case 'photoshoot':
return 'added to a photoshoot';
case 'leases':
Expand Down
5 changes: 1 addition & 4 deletions media-api/app/lib/ImagePersistenceReasons.scala
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,7 @@ case class IsInPersistedCollection(maybePersistOnlyTheseCollections: Option[Set[
}

override val query: Query = PersistedQueries.isInPersistedCollection(maybePersistOnlyTheseCollections)
override val reason: String = maybePersistOnlyTheseCollections match {
case None => "collection"
case Some(_) => "persisted-collection"
}
override val reason: String = "persisted-collection"
}

object AddedToPhotoshoot extends PersistenceReason {
Expand Down
2 changes: 0 additions & 2 deletions media-api/test/lib/ImagePersistenceReasonsTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class ImagePersistenceReasonsTest extends AnyFunSpec with Matchers {
val persistedCollections = Set("coll1", "coll2", "coll3")
val imgPersistenceReasons = ImagePersistenceReasons(Some(persistedCollections), persistedIdentifier)
val imagePersistenceReasonsWithEmptyListOfPersistedCollections = ImagePersistenceReasons(Some(Set.empty), persistedIdentifier)
val imagePersistenceReasonsWhichPersistsAllImagesInCollections = ImagePersistenceReasons(None, persistedIdentifier)

imgPersistenceReasons.reasons(img) shouldBe Nil
val imgWithPersistenceIdentifier = img.copy(identifiers = Map(persistedIdentifier -> "test-id"))
Expand All @@ -39,7 +38,6 @@ class ImagePersistenceReasonsTest extends AnyFunSpec with Matchers {
val imgInPersistedCollection = img.copy(collections = List(Collection.build(persistedCollections.headOption.toList, ActionData("testAuthor", now()))))
imgPersistenceReasons.reasons(imgInPersistedCollection) shouldBe List("persisted-collection")
imagePersistenceReasonsWithEmptyListOfPersistedCollections.reasons(imgInPersistedCollection) shouldBe List()
imagePersistenceReasonsWhichPersistsAllImagesInCollections.reasons(imgInPersistedCollection) shouldBe List("collection")

val imgWithPhotoshoot = img.copy(userMetadata = Some(Edits(metadata = ImageMetadata.empty, photoshoot = Some(Photoshoot("test")))))
imgPersistenceReasons.reasons(imgWithPhotoshoot) shouldBe List("photoshoot")
Expand Down

0 comments on commit f658ba2

Please sign in to comment.