From b4ee1a52e1365a01326ebf0bf8d4002504c57d71 Mon Sep 17 00:00:00 2001 From: eikek Date: Sat, 9 Apr 2022 20:33:06 +0200 Subject: [PATCH] Fix loading collective settings It responded with 404 when some sub-settings (classifier) didn't exist. --- .../src/main/scala/docspell/store/records/RCollective.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/store/src/main/scala/docspell/store/records/RCollective.scala b/modules/store/src/main/scala/docspell/store/records/RCollective.scala index 19ade621..2bbecaa6 100644 --- a/modules/store/src/main/scala/docspell/store/records/RCollective.scala +++ b/modules/store/src/main/scala/docspell/store/records/RCollective.scala @@ -97,11 +97,11 @@ object RCollective { def getSettings(coll: Ident): ConnectionIO[Option[Settings]] = (for { sett <- OptionT(getRawSettings(coll)) - prev <- OptionT.fromOption[ConnectionIO](sett.classifier) + prev <- OptionT.pure[ConnectionIO](sett.classifier) cats <- OptionT.liftF(RTag.listCategories(coll)) - next = prev.copy(categories = prev.categories.intersect(cats)) + next = prev.map(p => p.copy(categories = p.categories.intersect(cats))) pws <- OptionT.liftF(RCollectivePassword.findAll(coll)) - } yield sett.copy(classifier = Some(next), passwords = pws.map(_.password))).value + } yield sett.copy(classifier = next, passwords = pws.map(_.password))).value private def getRawSettings(coll: Ident): ConnectionIO[Option[Settings]] = { import RClassifierSetting.stringListMeta