Better handle no connections

This commit is contained in:
Eike Kettner 2020-04-21 18:01:11 +02:00
parent 2042824ab4
commit e7b81c701f
2 changed files with 8 additions and 2 deletions

View File

@ -79,7 +79,7 @@ object NotifyDueItemsRoutes {
} yield NotificationSettings( } yield NotificationSettings(
task.id, task.id,
task.enabled, task.enabled,
conn.getOrElse(Ident.unsafe("none")), conn.getOrElse(Ident.unsafe("")),
task.args.recipients, task.args.recipients,
task.timer, task.timer,
task.args.remindDays, task.args.remindDays,

View File

@ -24,6 +24,7 @@ import Html.Attributes exposing (..)
import Html.Events exposing (onCheck, onClick) import Html.Events exposing (onCheck, onClick)
import Http import Http
import Util.Http import Util.Http
import Util.Maybe
import Util.Tag import Util.Tag
import Util.Update import Util.Update
@ -271,9 +272,14 @@ update flags msg model =
SetNotificationSettings (Ok s) -> SetNotificationSettings (Ok s) ->
let let
smtp =
Util.Maybe.fromString s.smtpConnection
|> Maybe.map List.singleton
|> Maybe.withDefault []
( nm, nc ) = ( nm, nc ) =
Util.Update.andThen1 Util.Update.andThen1
[ update flags (ConnMsg (Comp.Dropdown.SetSelection [ s.smtpConnection ])) [ update flags (ConnMsg (Comp.Dropdown.SetSelection smtp))
, update flags (TagIncMsg (Comp.Dropdown.SetSelection s.tagsInclude)) , update flags (TagIncMsg (Comp.Dropdown.SetSelection s.tagsInclude))
, update flags (TagExcMsg (Comp.Dropdown.SetSelection s.tagsExclude)) , update flags (TagExcMsg (Comp.Dropdown.SetSelection s.tagsExclude))
] ]