Display quote toots

This only works with QOTO, but making it work with Pleroma should be
pretty easy.
This commit is contained in:
Ryan Fox 2022-01-23 18:27:22 -08:00
parent 5e9e974e95
commit 222d4277a7
Signed by: flewkey
GPG Key ID: 94F56ADFD848851E
5 changed files with 60 additions and 1 deletions

View File

@ -321,6 +321,29 @@ span.applink {
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.status-quote {
border: 2px solid #272b30;
border-radius: 15px;
padding: 8px;
margin-bottom: 8px;
}
.status-quote .avatar {
width: 40px;
}
.status-quote .display-name {
color: #c8c8c8;
}
.status-quote, .status-quote .status-text {
font-size: 14px !important;
}
.status-quote .status-text, .status-quote .username {
margin-left: 50px;
}
.follow-profile-date { .follow-profile-date {
font-weight: normal; font-weight: normal;
} }

View File

@ -14,6 +14,7 @@ module Mastodon.Decoder
, mentionDecoder , mentionDecoder
, notificationDecoder , notificationDecoder
, tagDecoder , tagDecoder
, quoteDecoder
, reblogDecoder , reblogDecoder
, relationshipDecoder , relationshipDecoder
, hashtagHistoryDecoder , hashtagHistoryDecoder
@ -217,6 +218,11 @@ tagDecoder =
|> Pipe.required "url" Decode.string |> Pipe.required "url" Decode.string
quoteDecoder : Decode.Decoder Quote
quoteDecoder =
Decode.map Quote (Decode.lazy (\_ -> statusDecoder))
reblogDecoder : Decode.Decoder Reblog reblogDecoder : Decode.Decoder Reblog
reblogDecoder = reblogDecoder =
Decode.map Reblog (Decode.lazy (\_ -> statusDecoder)) Decode.map Reblog (Decode.lazy (\_ -> statusDecoder))
@ -297,6 +303,7 @@ statusDecoder =
|> Pipe.required "in_reply_to_id" (Decode.nullable statusIdDecoder) |> Pipe.required "in_reply_to_id" (Decode.nullable statusIdDecoder)
|> Pipe.required "media_attachments" (Decode.list attachmentDecoder) |> Pipe.required "media_attachments" (Decode.list attachmentDecoder)
|> Pipe.required "mentions" (Decode.list mentionDecoder) |> Pipe.required "mentions" (Decode.list mentionDecoder)
|> Pipe.optional "quote" (Decode.lazy (\_ -> Decode.nullable quoteDecoder)) Nothing
|> Pipe.optional "reblog" (Decode.lazy (\_ -> Decode.nullable reblogDecoder)) Nothing |> Pipe.optional "reblog" (Decode.lazy (\_ -> Decode.nullable reblogDecoder)) Nothing
|> Pipe.optional "reblogged" (Decode.nullable Decode.bool) Nothing |> Pipe.optional "reblogged" (Decode.nullable Decode.bool) Nothing
|> Pipe.required "reblogs_count" Decode.int |> Pipe.required "reblogs_count" Decode.int

View File

@ -1,6 +1,7 @@
module Mastodon.Helper module Mastodon.Helper
exposing exposing
( extractReblog ( extractQuote
, extractReblog
, aggregateNotifications , aggregateNotifications
, addNotificationToAggregates , addNotificationToAggregates
, extractStatusId , extractStatusId
@ -14,6 +15,11 @@ import List.Extra exposing (groupWhile, uniqueBy)
import Mastodon.Model exposing (..) import Mastodon.Model exposing (..)
extractQuote : Status -> Maybe Quote
extractQuote status =
status.quote
extractReblog : Status -> Status extractReblog : Status -> Status
extractReblog status = extractReblog status =
case status.reblog of case status.reblog of

View File

@ -17,6 +17,7 @@ module Mastodon.Model
, Mention , Mention
, Notification , Notification
, NotificationAggregate , NotificationAggregate
, Quote(..)
, Reblog(..) , Reblog(..)
, Relationship , Relationship
, Tag , Tag
@ -214,6 +215,10 @@ type alias NotificationAggregate =
} }
type Quote
= Quote Status
type Reblog type Reblog
= Reblog Status = Reblog Status
@ -290,6 +295,7 @@ type alias Status =
, in_reply_to_id : Maybe StatusId , in_reply_to_id : Maybe StatusId
, media_attachments : List Attachment , media_attachments : List Attachment
, mentions : List Mention , mentions : List Mention
, quote : Maybe Quote
, reblog : Maybe Reblog , reblog : Maybe Reblog
, reblogged : Maybe Bool , reblogged : Maybe Bool
, reblogs_count : Int , reblogs_count : Int

View File

@ -216,6 +216,21 @@ mentionView mention =
] ]
quoteView : Status -> Html Msg
quoteView status =
let
quote =
Mastodon.Helper.extractQuote status
in
case quote of
Just (Quote quote) ->
div [ class "status-quote" ]
[ statusView "quote" quote True ]
Nothing ->
text ""
mentionsView : List Mention -> Html Msg mentionsView : List Mention -> Html Msg
mentionsView mentions = mentionsView mentions =
let let
@ -238,6 +253,7 @@ statusContentView context status =
, div [] <| formatContent status.content status.mentions , div [] <| formatContent status.content status.mentions
, pollView status , pollView status
, attachmentListView context status , attachmentListView context status
, quoteView status
] ]
spoiler -> spoiler ->
@ -256,6 +272,7 @@ statusContentView context status =
, div [] <| formatContent status.content status.mentions , div [] <| formatContent status.content status.mentions
, pollView status , pollView status
, attachmentListView context status , attachmentListView context status
, quoteView status
] ]
] ]