1
0
Fork 0

Pleroma: Support quote posts

This commit is contained in:
Ryan Fox 2022-03-24 18:27:46 -07:00
parent 1053544ddc
commit 5566d320f5
Signed by: flewkey
GPG Key ID: 94F56ADFD848851E
3 changed files with 21 additions and 2 deletions

View File

@ -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

View File

@ -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

View File

@ -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
}