From ad816cc3ffcd50b09145706678abeded2f4cd1cc Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Tue, 14 Aug 2018 03:36:57 -0400 Subject: [PATCH] Fix Author --- advanced/part1/src/Author.elm | 6 +++--- advanced/part2/src/Author.elm | 6 +++--- advanced/part3/src/Author.elm | 6 +++--- advanced/part4/src/Author.elm | 6 +++--- advanced/part5/src/Author.elm | 6 +++--- advanced/part6/src/Author.elm | 6 +++--- advanced/part7/src/Author.elm | 6 +++--- advanced/part8/src/Author.elm | 6 +++--- intro/part5/src/Author.elm | 6 +++--- intro/part6/src/Author.elm | 6 +++--- intro/part7/src/Author.elm | 6 +++--- intro/part8/src/Author.elm | 6 +++--- intro/part9/src/Author.elm | 6 +++--- 13 files changed, 39 insertions(+), 39 deletions(-) diff --git a/advanced/part1/src/Author.elm b/advanced/part1/src/Author.elm index 827d18a..51cec3d 100644 --- a/advanced/part1/src/Author.elm +++ b/advanced/part1/src/Author.elm @@ -54,7 +54,7 @@ import Html.Events exposing (onClick) import Http import HttpBuilder exposing (RequestBuilder, withExpect) import Json.Decode as Decode exposing (Decoder) -import Json.Decode.Pipeline exposing (custom, required) +import Json.Decode.Pipeline exposing (custom, optional, required) import Json.Encode as Encode exposing (Value) import Profile exposing (Profile) import Route exposing (Route) @@ -229,8 +229,8 @@ decodeFromPair maybeCred ( prof, uname ) = nonViewerDecoder : Profile -> Username -> Decoder Author nonViewerDecoder prof uname = - Decode.field "following" Decode.bool - |> Decode.map (authorFromFollowing prof uname) + Decode.succeed (authorFromFollowing prof uname) + |> optional "following" Decode.bool False authorFromFollowing : Profile -> Username -> Bool -> Author diff --git a/advanced/part2/src/Author.elm b/advanced/part2/src/Author.elm index e7de3c5..b70bcb3 100644 --- a/advanced/part2/src/Author.elm +++ b/advanced/part2/src/Author.elm @@ -54,7 +54,7 @@ import Html.Events exposing (onClick) import Http import HttpBuilder exposing (RequestBuilder, withExpect) import Json.Decode as Decode exposing (Decoder) -import Json.Decode.Pipeline exposing (custom, required) +import Json.Decode.Pipeline exposing (custom, optional, required) import Json.Encode as Encode exposing (Value) import Profile exposing (Profile) import Route exposing (Route) @@ -229,8 +229,8 @@ decodeFromPair maybeCred ( prof, uname ) = nonViewerDecoder : Profile -> Username -> Decoder Author nonViewerDecoder prof uname = - Decode.field "following" Decode.bool - |> Decode.map (authorFromFollowing prof uname) + Decode.succeed (authorFromFollowing prof uname) + |> optional "following" Decode.bool False authorFromFollowing : Profile -> Username -> Bool -> Author diff --git a/advanced/part3/src/Author.elm b/advanced/part3/src/Author.elm index e7de3c5..b70bcb3 100644 --- a/advanced/part3/src/Author.elm +++ b/advanced/part3/src/Author.elm @@ -54,7 +54,7 @@ import Html.Events exposing (onClick) import Http import HttpBuilder exposing (RequestBuilder, withExpect) import Json.Decode as Decode exposing (Decoder) -import Json.Decode.Pipeline exposing (custom, required) +import Json.Decode.Pipeline exposing (custom, optional, required) import Json.Encode as Encode exposing (Value) import Profile exposing (Profile) import Route exposing (Route) @@ -229,8 +229,8 @@ decodeFromPair maybeCred ( prof, uname ) = nonViewerDecoder : Profile -> Username -> Decoder Author nonViewerDecoder prof uname = - Decode.field "following" Decode.bool - |> Decode.map (authorFromFollowing prof uname) + Decode.succeed (authorFromFollowing prof uname) + |> optional "following" Decode.bool False authorFromFollowing : Profile -> Username -> Bool -> Author diff --git a/advanced/part4/src/Author.elm b/advanced/part4/src/Author.elm index e7de3c5..b70bcb3 100644 --- a/advanced/part4/src/Author.elm +++ b/advanced/part4/src/Author.elm @@ -54,7 +54,7 @@ import Html.Events exposing (onClick) import Http import HttpBuilder exposing (RequestBuilder, withExpect) import Json.Decode as Decode exposing (Decoder) -import Json.Decode.Pipeline exposing (custom, required) +import Json.Decode.Pipeline exposing (custom, optional, required) import Json.Encode as Encode exposing (Value) import Profile exposing (Profile) import Route exposing (Route) @@ -229,8 +229,8 @@ decodeFromPair maybeCred ( prof, uname ) = nonViewerDecoder : Profile -> Username -> Decoder Author nonViewerDecoder prof uname = - Decode.field "following" Decode.bool - |> Decode.map (authorFromFollowing prof uname) + Decode.succeed (authorFromFollowing prof uname) + |> optional "following" Decode.bool False authorFromFollowing : Profile -> Username -> Bool -> Author diff --git a/advanced/part5/src/Author.elm b/advanced/part5/src/Author.elm index e7de3c5..b70bcb3 100644 --- a/advanced/part5/src/Author.elm +++ b/advanced/part5/src/Author.elm @@ -54,7 +54,7 @@ import Html.Events exposing (onClick) import Http import HttpBuilder exposing (RequestBuilder, withExpect) import Json.Decode as Decode exposing (Decoder) -import Json.Decode.Pipeline exposing (custom, required) +import Json.Decode.Pipeline exposing (custom, optional, required) import Json.Encode as Encode exposing (Value) import Profile exposing (Profile) import Route exposing (Route) @@ -229,8 +229,8 @@ decodeFromPair maybeCred ( prof, uname ) = nonViewerDecoder : Profile -> Username -> Decoder Author nonViewerDecoder prof uname = - Decode.field "following" Decode.bool - |> Decode.map (authorFromFollowing prof uname) + Decode.succeed (authorFromFollowing prof uname) + |> optional "following" Decode.bool False authorFromFollowing : Profile -> Username -> Bool -> Author diff --git a/advanced/part6/src/Author.elm b/advanced/part6/src/Author.elm index e7de3c5..b70bcb3 100644 --- a/advanced/part6/src/Author.elm +++ b/advanced/part6/src/Author.elm @@ -54,7 +54,7 @@ import Html.Events exposing (onClick) import Http import HttpBuilder exposing (RequestBuilder, withExpect) import Json.Decode as Decode exposing (Decoder) -import Json.Decode.Pipeline exposing (custom, required) +import Json.Decode.Pipeline exposing (custom, optional, required) import Json.Encode as Encode exposing (Value) import Profile exposing (Profile) import Route exposing (Route) @@ -229,8 +229,8 @@ decodeFromPair maybeCred ( prof, uname ) = nonViewerDecoder : Profile -> Username -> Decoder Author nonViewerDecoder prof uname = - Decode.field "following" Decode.bool - |> Decode.map (authorFromFollowing prof uname) + Decode.succeed (authorFromFollowing prof uname) + |> optional "following" Decode.bool False authorFromFollowing : Profile -> Username -> Bool -> Author diff --git a/advanced/part7/src/Author.elm b/advanced/part7/src/Author.elm index ad3b83b..5efcae8 100644 --- a/advanced/part7/src/Author.elm +++ b/advanced/part7/src/Author.elm @@ -54,7 +54,7 @@ import Html.Events exposing (onClick) import Http import HttpBuilder exposing (RequestBuilder, withExpect) import Json.Decode as Decode exposing (Decoder) -import Json.Decode.Pipeline exposing (custom, required) +import Json.Decode.Pipeline exposing (custom, optional, required) import Json.Encode as Encode exposing (Value) import Profile exposing (Profile) import Route exposing (Route) @@ -232,8 +232,8 @@ decoderHelp maybeCred prof uname = nonViewerDecoder : Profile -> Username -> Decoder Author nonViewerDecoder prof uname = - Decode.field "following" Decode.bool - |> Decode.map (authorFromFollowing prof uname) + Decode.succeed (authorFromFollowing prof uname) + |> optional "following" Decode.bool False authorFromFollowing : Profile -> Username -> Bool -> Author diff --git a/advanced/part8/src/Author.elm b/advanced/part8/src/Author.elm index e7de3c5..b70bcb3 100644 --- a/advanced/part8/src/Author.elm +++ b/advanced/part8/src/Author.elm @@ -54,7 +54,7 @@ import Html.Events exposing (onClick) import Http import HttpBuilder exposing (RequestBuilder, withExpect) import Json.Decode as Decode exposing (Decoder) -import Json.Decode.Pipeline exposing (custom, required) +import Json.Decode.Pipeline exposing (custom, optional, required) import Json.Encode as Encode exposing (Value) import Profile exposing (Profile) import Route exposing (Route) @@ -229,8 +229,8 @@ decodeFromPair maybeCred ( prof, uname ) = nonViewerDecoder : Profile -> Username -> Decoder Author nonViewerDecoder prof uname = - Decode.field "following" Decode.bool - |> Decode.map (authorFromFollowing prof uname) + Decode.succeed (authorFromFollowing prof uname) + |> optional "following" Decode.bool False authorFromFollowing : Profile -> Username -> Bool -> Author diff --git a/intro/part5/src/Author.elm b/intro/part5/src/Author.elm index e7de3c5..b70bcb3 100644 --- a/intro/part5/src/Author.elm +++ b/intro/part5/src/Author.elm @@ -54,7 +54,7 @@ import Html.Events exposing (onClick) import Http import HttpBuilder exposing (RequestBuilder, withExpect) import Json.Decode as Decode exposing (Decoder) -import Json.Decode.Pipeline exposing (custom, required) +import Json.Decode.Pipeline exposing (custom, optional, required) import Json.Encode as Encode exposing (Value) import Profile exposing (Profile) import Route exposing (Route) @@ -229,8 +229,8 @@ decodeFromPair maybeCred ( prof, uname ) = nonViewerDecoder : Profile -> Username -> Decoder Author nonViewerDecoder prof uname = - Decode.field "following" Decode.bool - |> Decode.map (authorFromFollowing prof uname) + Decode.succeed (authorFromFollowing prof uname) + |> optional "following" Decode.bool False authorFromFollowing : Profile -> Username -> Bool -> Author diff --git a/intro/part6/src/Author.elm b/intro/part6/src/Author.elm index e7de3c5..b70bcb3 100644 --- a/intro/part6/src/Author.elm +++ b/intro/part6/src/Author.elm @@ -54,7 +54,7 @@ import Html.Events exposing (onClick) import Http import HttpBuilder exposing (RequestBuilder, withExpect) import Json.Decode as Decode exposing (Decoder) -import Json.Decode.Pipeline exposing (custom, required) +import Json.Decode.Pipeline exposing (custom, optional, required) import Json.Encode as Encode exposing (Value) import Profile exposing (Profile) import Route exposing (Route) @@ -229,8 +229,8 @@ decodeFromPair maybeCred ( prof, uname ) = nonViewerDecoder : Profile -> Username -> Decoder Author nonViewerDecoder prof uname = - Decode.field "following" Decode.bool - |> Decode.map (authorFromFollowing prof uname) + Decode.succeed (authorFromFollowing prof uname) + |> optional "following" Decode.bool False authorFromFollowing : Profile -> Username -> Bool -> Author diff --git a/intro/part7/src/Author.elm b/intro/part7/src/Author.elm index e7de3c5..b70bcb3 100644 --- a/intro/part7/src/Author.elm +++ b/intro/part7/src/Author.elm @@ -54,7 +54,7 @@ import Html.Events exposing (onClick) import Http import HttpBuilder exposing (RequestBuilder, withExpect) import Json.Decode as Decode exposing (Decoder) -import Json.Decode.Pipeline exposing (custom, required) +import Json.Decode.Pipeline exposing (custom, optional, required) import Json.Encode as Encode exposing (Value) import Profile exposing (Profile) import Route exposing (Route) @@ -229,8 +229,8 @@ decodeFromPair maybeCred ( prof, uname ) = nonViewerDecoder : Profile -> Username -> Decoder Author nonViewerDecoder prof uname = - Decode.field "following" Decode.bool - |> Decode.map (authorFromFollowing prof uname) + Decode.succeed (authorFromFollowing prof uname) + |> optional "following" Decode.bool False authorFromFollowing : Profile -> Username -> Bool -> Author diff --git a/intro/part8/src/Author.elm b/intro/part8/src/Author.elm index e7de3c5..b70bcb3 100644 --- a/intro/part8/src/Author.elm +++ b/intro/part8/src/Author.elm @@ -54,7 +54,7 @@ import Html.Events exposing (onClick) import Http import HttpBuilder exposing (RequestBuilder, withExpect) import Json.Decode as Decode exposing (Decoder) -import Json.Decode.Pipeline exposing (custom, required) +import Json.Decode.Pipeline exposing (custom, optional, required) import Json.Encode as Encode exposing (Value) import Profile exposing (Profile) import Route exposing (Route) @@ -229,8 +229,8 @@ decodeFromPair maybeCred ( prof, uname ) = nonViewerDecoder : Profile -> Username -> Decoder Author nonViewerDecoder prof uname = - Decode.field "following" Decode.bool - |> Decode.map (authorFromFollowing prof uname) + Decode.succeed (authorFromFollowing prof uname) + |> optional "following" Decode.bool False authorFromFollowing : Profile -> Username -> Bool -> Author diff --git a/intro/part9/src/Author.elm b/intro/part9/src/Author.elm index e7de3c5..b70bcb3 100644 --- a/intro/part9/src/Author.elm +++ b/intro/part9/src/Author.elm @@ -54,7 +54,7 @@ import Html.Events exposing (onClick) import Http import HttpBuilder exposing (RequestBuilder, withExpect) import Json.Decode as Decode exposing (Decoder) -import Json.Decode.Pipeline exposing (custom, required) +import Json.Decode.Pipeline exposing (custom, optional, required) import Json.Encode as Encode exposing (Value) import Profile exposing (Profile) import Route exposing (Route) @@ -229,8 +229,8 @@ decodeFromPair maybeCred ( prof, uname ) = nonViewerDecoder : Profile -> Username -> Decoder Author nonViewerDecoder prof uname = - Decode.field "following" Decode.bool - |> Decode.map (authorFromFollowing prof uname) + Decode.succeed (authorFromFollowing prof uname) + |> optional "following" Decode.bool False authorFromFollowing : Profile -> Username -> Bool -> Author