mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 10:28:27 +00:00
Merge pull request #1580 from eikek/fix/mail-address-input
Fix/mail address input
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
package docspell.restserver.routes
|
package docspell.restserver.routes
|
||||||
|
|
||||||
import cats.data.NonEmptyList
|
import cats.data.{EitherT, NonEmptyList}
|
||||||
import cats.effect._
|
import cats.effect._
|
||||||
import cats.implicits._
|
import cats.implicits._
|
||||||
|
|
||||||
@ -64,17 +64,29 @@ object NotificationRoutes extends NonEmptyListSupport {
|
|||||||
case req @ POST -> Root =>
|
case req @ POST -> Root =>
|
||||||
for {
|
for {
|
||||||
input <- req.as[NotificationChannel]
|
input <- req.as[NotificationChannel]
|
||||||
ch <- Sync[F].pure(NotificationChannel.convert(input)).rethrow
|
ch <- Sync[F].pure(NotificationChannel.convert(input))
|
||||||
res <- backend.notification.createChannel(ch, user.account)
|
resp <- EitherT
|
||||||
resp <- Ok(Conversions.basicResult(res, "Channel created"))
|
.fromEither[F](ch)
|
||||||
|
.semiflatMap { c =>
|
||||||
|
backend.notification
|
||||||
|
.createChannel(c, user.account)
|
||||||
|
.map(res => Conversions.basicResult(res, "Channel created"))
|
||||||
|
}
|
||||||
|
.foldF(ex => BadRequest(BasicResult(false, ex.getMessage)), Ok(_))
|
||||||
} yield resp
|
} yield resp
|
||||||
|
|
||||||
case req @ PUT -> Root =>
|
case req @ PUT -> Root =>
|
||||||
for {
|
for {
|
||||||
input <- req.as[NotificationChannel]
|
input <- req.as[NotificationChannel]
|
||||||
ch <- Sync[F].pure(NotificationChannel.convert(input)).rethrow
|
ch <- Sync[F].pure(NotificationChannel.convert(input))
|
||||||
res <- backend.notification.updateChannel(ch, user.account)
|
resp <- EitherT
|
||||||
resp <- Ok(Conversions.basicResult(res, "Channel created"))
|
.fromEither[F](ch)
|
||||||
|
.semiflatMap { c =>
|
||||||
|
backend.notification
|
||||||
|
.updateChannel(c, user.account)
|
||||||
|
.map(res => Conversions.basicResult(res, "Channel created"))
|
||||||
|
}
|
||||||
|
.foldF(ex => BadRequest(BasicResult(false, ex.getMessage)), Ok(_))
|
||||||
} yield resp
|
} yield resp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,11 @@ view2 cfg values model =
|
|||||||
, placeholder cfg.placeholder
|
, placeholder cfg.placeholder
|
||||||
, onKeyUp KeyPress
|
, onKeyUp KeyPress
|
||||||
, onInput SetInput
|
, onInput SetInput
|
||||||
, onBlur (KeyPress 13)
|
, if List.isEmpty model.candidates then
|
||||||
|
onBlur (KeyPress 13)
|
||||||
|
|
||||||
|
else
|
||||||
|
class ""
|
||||||
, class "inline-flex w-24 border-0 px-0 focus:ring-0 h-6 text-sm"
|
, class "inline-flex w-24 border-0 px-0 focus:ring-0 h-6 text-sm"
|
||||||
, class "placeholder-gray-400 dark:text-slate-200 dark:bg-slate-800 dark:border-slate-500"
|
, class "placeholder-gray-400 dark:text-slate-200 dark:bg-slate-800 dark:border-slate-500"
|
||||||
]
|
]
|
||||||
|
Reference in New Issue
Block a user