Make the preview_url optional
It won't always be present, especially for media like audio. (I'll fix audio eventually.)
This commit is contained in:
parent
7eb414190a
commit
be05f24b52
@ -85,7 +85,7 @@ attachmentDecoder =
|
||||
|> Pipe.required "type" Decode.string
|
||||
|> Pipe.required "url" Decode.string
|
||||
|> Pipe.optional "remote_url" Decode.string ""
|
||||
|> Pipe.required "preview_url" Decode.string
|
||||
|> Pipe.optional "preview_url" Decode.string ""
|
||||
|> Pipe.required "text_url" (Decode.nullable Decode.string)
|
||||
|
||||
|
||||
|
@ -42,7 +42,14 @@ attachmentPreview context sensitive attachments ({ url, preview_url } as attachm
|
||||
, onClickWithPreventAndStop <|
|
||||
ViewerEvent (OpenViewer attachments attachment)
|
||||
]
|
||||
[ img [ src preview_url ] [] ]
|
||||
[ img [ src <|
|
||||
if preview_url == "" then
|
||||
url
|
||||
else
|
||||
preview_url
|
||||
]
|
||||
[]
|
||||
]
|
||||
in
|
||||
li [ class "attachment-entry" ] <|
|
||||
if nsfw then
|
||||
|
Loading…
Reference in New Issue
Block a user