From a7826c5c2b8de5d03b88ed3950aec8812b489814 Mon Sep 17 00:00:00 2001 From: Nicolas Perriault Date: Sun, 14 May 2017 15:12:04 +0200 Subject: [PATCH] Fixed status url may be missing in a toot. --- src/Mastodon/Decoder.elm | 2 +- src/Mastodon/Model.elm | 2 +- src/View/Status.elm | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Mastodon/Decoder.elm b/src/Mastodon/Decoder.elm index f07ab99..93a54ec 100644 --- a/src/Mastodon/Decoder.elm +++ b/src/Mastodon/Decoder.elm @@ -144,7 +144,7 @@ statusDecoder = |> Pipe.required "spoiler_text" Decode.string |> Pipe.required "tags" (Decode.list tagDecoder) |> Pipe.required "uri" Decode.string - |> Pipe.required "url" Decode.string + |> Pipe.required "url" (Decode.nullable Decode.string) |> Pipe.required "visibility" Decode.string diff --git a/src/Mastodon/Model.elm b/src/Mastodon/Model.elm index f12e1c8..5775177 100644 --- a/src/Mastodon/Model.elm +++ b/src/Mastodon/Model.elm @@ -179,7 +179,7 @@ type alias Status = , spoiler_text : String , tags : List Tag , uri : String - , url : String + , url : Maybe String , visibility : String } diff --git a/src/View/Status.elm b/src/View/Status.elm index dc6078b..d9525e4 100644 --- a/src/View/Status.elm +++ b/src/View/Status.elm @@ -150,7 +150,7 @@ statusActionsView status currentUser = else text "" , a - [ class baseBtnClasses, href status.url, target "_blank" ] + [ class baseBtnClasses, href (Maybe.withDefault "#" status.url), target "_blank" ] [ Common.icon "time", formatDate ] ]