diff --git a/src/Mastodon/Decoder.elm b/src/Mastodon/Decoder.elm index bc4c615..bc9b029 100644 --- a/src/Mastodon/Decoder.elm +++ b/src/Mastodon/Decoder.elm @@ -22,6 +22,7 @@ module Mastodon.Decoder , searchResultsDecoder , statusDecoder , webSocketEventDecoder + , pleromaDecoder , pollIdDecoder , pollOptionDecoder , pollDecoder @@ -262,6 +263,12 @@ idDecoder = ] +pleromaDecoder : Decode.Decoder Pleroma +pleromaDecoder = + Pipe.decode Pleroma + |> Pipe.optional "quote" (Decode.lazy (\_ -> Decode.nullable quoteDecoder)) Nothing + + pollIdDecoder : Decode.Decoder PollId pollIdDecoder = idDecoder |> Decode.map PollId @@ -313,6 +320,7 @@ statusDecoder = |> Pipe.required "uri" Decode.string |> Pipe.required "url" (Decode.nullable Decode.string) |> Pipe.required "visibility" Decode.string + |> Pipe.optional "pleroma" (Decode.lazy (\_ -> Decode.nullable pleromaDecoder)) Nothing |> Pipe.optional "poll" pollDecoder { id = PollId("") , expired = False diff --git a/src/Mastodon/Helper.elm b/src/Mastodon/Helper.elm index ca55c8e..d6573ce 100644 --- a/src/Mastodon/Helper.elm +++ b/src/Mastodon/Helper.elm @@ -14,10 +14,14 @@ module Mastodon.Helper import List.Extra exposing (groupWhile, uniqueBy) import Mastodon.Model exposing (..) - extractQuote : Status -> Maybe Quote extractQuote status = - status.quote + case status.pleroma of + Just pleroma -> + pleroma.quote + + Nothing-> + status.quote extractReblog : Status -> Status diff --git a/src/Mastodon/Model.elm b/src/Mastodon/Model.elm index 58e41da..bdf708a 100644 --- a/src/Mastodon/Model.elm +++ b/src/Mastodon/Model.elm @@ -21,6 +21,7 @@ module Mastodon.Model , Reblog(..) , Relationship , Tag + , Pleroma , PollId(..) , PollOption , Poll @@ -247,6 +248,11 @@ type alias Hashtag = } +type alias Pleroma = + { quote : Maybe Quote + } + + type PollId = PollId String @@ -305,6 +311,7 @@ type alias Status = , uri : String , url : Maybe String , visibility : String + , pleroma : Maybe Pleroma , poll : Poll , pinned : Bool -- Not a real value, used to show pinned indicator }