Pleroma: Support quote posts
This commit is contained in:
parent
1053544ddc
commit
5566d320f5
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user