diff of 7f6399176fae9fc1ed87c559df561d04a2b23216
7f6399176fae9fc1ed87c559df561d04a2b23216
diff --git a/elm-frontti/src/Main.elm b/elm-frontti/src/Main.elm
index fe216c3..212c705 100644
--- a/elm-frontti/src/Main.elm
+++ b/elm-frontti/src/Main.elm
@@ -64,7 +64,7 @@ subscriptions _ = Sub.batch
[ tags ReceivedTag
, aceStateUpdate AceStateUpdate]
-initialModel url key viewstate = Model viewstate Nothing False False [] Nothing LoggedOut key url Nothing Time.utc Nothing
+initialModel url key viewstate = Model viewstate Nothing False False [] Nothing LoggedOut key url Nothing Time.utc Nothing []
viewStatePerUrl : Url.Url -> (ViewState, List (Cmd Msg))
viewStatePerUrl url =
@@ -157,7 +157,7 @@ update msg model =
TitlesReceived result ->
case result of
Ok decoded_titles ->
- ({ model | settings = Maybe.map (\s -> {s | titles = Just decoded_titles}) model.settings}
+ ({ model | titles = decoded_titles}
, Cmd.none)
Err error ->
( model
@@ -519,11 +519,7 @@ view model =
Nothing -> [ div [] [ text "No post loaded" ]]
MediaList -> [ medialist model.loadedImages model.medialist_state ])
, div [id "sidebar"] [ User.loginView model.loginState
- , (case settings.titles of
- Just titles ->
- sidebarHistory titles
- Nothing ->
- div [] [text "Loading history failed"])
+ , (sidebarHistory model.titles )
, (case model.view_state of
PostEditorList titles -> PostsAdmin.tagList titles
diff --git a/elm-frontti/src/Message.elm b/elm-frontti/src/Message.elm
index 81a2c0b..524504e 100644
--- a/elm-frontti/src/Message.elm
+++ b/elm-frontti/src/Message.elm
@@ -71,7 +71,9 @@ type alias Model =
, url : Url.Url
, postEditorSettings: Maybe PostEditorSettings
, zone : Time.Zone
- , postFromLocalStorage : Maybe Article.Article}
+ , postFromLocalStorage : Maybe Article.Article
+ , titles : List Article.Title
+ }
type Msg
= PageReceived (Result Http.Error P.Page)
diff --git a/elm-frontti/src/Settings.elm b/elm-frontti/src/Settings.elm
index 06d0ddd..d3d4f34 100644
--- a/elm-frontti/src/Settings.elm
+++ b/elm-frontti/src/Settings.elm
@@ -19,14 +19,11 @@ type alias Settings =
, blog_title : String
, recent_post_count : Int
, xss_filter_posts : Bool
-
- , titles : Maybe (List Article.Title) --for reasons fucking unknown, growing Main.Model beoynd 2 fields breaks everything.
}
-settingsDecoder = Decode.map5 Settings
+settingsDecoder = Decode.map4 Settings
(Decode.field "time-format" Decode.string)
(Decode.field "blog-title" Decode.string)
(Decode.field "recent-post-count" Decode.int)
(Decode.field "xss-filter-posts?" Decode.bool)
- (Decode.maybe (Decode.list (Decode.field "does-not-exist" Article.sidebarTitleDecoder)))