From a6e79a32a8e18e7c8fa6f74552d1347ae009eb04 Mon Sep 17 00:00:00 2001 From: moerfi Date: Sat, 22 Jan 2022 22:14:21 +0100 Subject: [PATCH] Change scanRecursively to an Option field --- .../src/main/scala/docspell/common/ScanMailboxArgs.scala | 2 +- .../scala/docspell/joex/scanmailbox/ScanMailboxTask.scala | 2 +- .../scala/docspell/restserver/routes/ScanMailboxRoutes.scala | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/common/src/main/scala/docspell/common/ScanMailboxArgs.scala b/modules/common/src/main/scala/docspell/common/ScanMailboxArgs.scala index 2a025386..9b886c90 100644 --- a/modules/common/src/main/scala/docspell/common/ScanMailboxArgs.scala +++ b/modules/common/src/main/scala/docspell/common/ScanMailboxArgs.scala @@ -24,7 +24,7 @@ case class ScanMailboxArgs( // the configured imap connection imapConnection: Ident, // scan folders recursively - scanRecursively: Boolean, + scanRecursively: Option[Boolean], // what folders to search folders: List[String], // only select mails received since then diff --git a/modules/joex/src/main/scala/docspell/joex/scanmailbox/ScanMailboxTask.scala b/modules/joex/src/main/scala/docspell/joex/scanmailbox/ScanMailboxTask.scala index acb8f7c7..c5cd8ff5 100644 --- a/modules/joex/src/main/scala/docspell/joex/scanmailbox/ScanMailboxTask.scala +++ b/modules/joex/src/main/scala/docspell/joex/scanmailbox/ScanMailboxTask.scala @@ -98,7 +98,7 @@ object ScanMailboxTask { if (acc.noneLeft(name)) acc.pure[F] else mailer - .run(impl.handleFolder(theEmil.access, upload)(name, ctx.args.scanRecursively)) + .run(impl.handleFolder(theEmil.access, upload)(name, ctx.args.scanRecursively.getOrElse(false))) .map(_ ++ acc) Stream diff --git a/modules/restserver/src/main/scala/docspell/restserver/routes/ScanMailboxRoutes.scala b/modules/restserver/src/main/scala/docspell/restserver/routes/ScanMailboxRoutes.scala index 87b0a9e6..61f27c11 100644 --- a/modules/restserver/src/main/scala/docspell/restserver/routes/ScanMailboxRoutes.scala +++ b/modules/restserver/src/main/scala/docspell/restserver/routes/ScanMailboxRoutes.scala @@ -115,7 +115,7 @@ object ScanMailboxRoutes { ScanMailboxArgs( user, settings.imapConnection, - settings.scanRecursively, + Option(settings.scanRecursively), settings.folders, settings.receivedSinceHours.map(_.toLong).map(Duration.hours), settings.targetFolder, @@ -151,7 +151,7 @@ object ScanMailboxRoutes { task.summary, conn.getOrElse(Ident.unsafe("")), task.args.folders, - task.args.scanRecursively, + task.args.scanRecursively.getOrElse(false), task.timer, task.args.receivedSince.map(_.hours.toInt), task.args.targetFolder,