Render app link in target thread toot.
This commit is contained in:
parent
b180cc42e3
commit
b6c858da2d
@ -120,6 +120,10 @@ li.load-more {
|
|||||||
background: #493438;
|
background: #493438;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
span.applink {
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
.reblog > p:first-of-type,
|
.reblog > p:first-of-type,
|
||||||
.notification > p:first-of-type {
|
.notification > p:first-of-type {
|
||||||
color: #999;
|
color: #999;
|
||||||
|
@ -59,6 +59,13 @@ accountDecoder =
|
|||||||
|> Pipe.required "username" Decode.string
|
|> Pipe.required "username" Decode.string
|
||||||
|
|
||||||
|
|
||||||
|
applicationDecoder : Decode.Decoder Application
|
||||||
|
applicationDecoder =
|
||||||
|
Pipe.decode Application
|
||||||
|
|> Pipe.required "name" Decode.string
|
||||||
|
|> Pipe.required "website" (Decode.nullable Decode.string)
|
||||||
|
|
||||||
|
|
||||||
attachmentDecoder : Decode.Decoder Attachment
|
attachmentDecoder : Decode.Decoder Attachment
|
||||||
attachmentDecoder =
|
attachmentDecoder =
|
||||||
Pipe.decode Attachment
|
Pipe.decode Attachment
|
||||||
@ -128,6 +135,7 @@ statusDecoder : Decode.Decoder Status
|
|||||||
statusDecoder =
|
statusDecoder =
|
||||||
Pipe.decode Status
|
Pipe.decode Status
|
||||||
|> Pipe.required "account" accountDecoder
|
|> Pipe.required "account" accountDecoder
|
||||||
|
|> Pipe.required "application" (Decode.nullable applicationDecoder)
|
||||||
|> Pipe.required "content" Decode.string
|
|> Pipe.required "content" Decode.string
|
||||||
|> Pipe.required "created_at" Decode.string
|
|> Pipe.required "created_at" Decode.string
|
||||||
|> Pipe.optional "favourited" (Decode.nullable Decode.bool) Nothing
|
|> Pipe.optional "favourited" (Decode.nullable Decode.bool) Nothing
|
||||||
|
@ -3,6 +3,7 @@ module Mastodon.Model
|
|||||||
( AccessTokenResult
|
( AccessTokenResult
|
||||||
, AppRegistration
|
, AppRegistration
|
||||||
, Account
|
, Account
|
||||||
|
, Application
|
||||||
, Attachment
|
, Attachment
|
||||||
, Client
|
, Client
|
||||||
, Context
|
, Context
|
||||||
@ -90,6 +91,12 @@ type alias Account =
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
type alias Application =
|
||||||
|
{ name : String
|
||||||
|
, website : Maybe String
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
type alias Attachment =
|
type alias Attachment =
|
||||||
-- type_: -- "image", "video", "gifv"
|
-- type_: -- "image", "video", "gifv"
|
||||||
{ id : Int
|
{ id : Int
|
||||||
@ -163,6 +170,7 @@ type alias Relationship =
|
|||||||
|
|
||||||
type alias Status =
|
type alias Status =
|
||||||
{ account : Account
|
{ account : Account
|
||||||
|
, application : Maybe Application
|
||||||
, content : String
|
, content : String
|
||||||
, created_at : String
|
, created_at : String
|
||||||
, favourited : Maybe Bool
|
, favourited : Maybe Bool
|
||||||
|
@ -3,6 +3,7 @@ module View.Common
|
|||||||
( accountAvatar
|
( accountAvatar
|
||||||
, accountAvatarLink
|
, accountAvatarLink
|
||||||
, accountLink
|
, accountLink
|
||||||
|
, appLink
|
||||||
, closeablePanelheading
|
, closeablePanelheading
|
||||||
, icon
|
, icon
|
||||||
, justifiedButtonGroup
|
, justifiedButtonGroup
|
||||||
@ -63,6 +64,21 @@ accountAvatarLink external account =
|
|||||||
[ accountAvatar avatarClass account ]
|
[ accountAvatar avatarClass account ]
|
||||||
|
|
||||||
|
|
||||||
|
appLink : String -> Maybe Application -> Html Msg
|
||||||
|
appLink classes app =
|
||||||
|
case app of
|
||||||
|
Nothing ->
|
||||||
|
text ""
|
||||||
|
|
||||||
|
Just { name, website } ->
|
||||||
|
case website of
|
||||||
|
Nothing ->
|
||||||
|
span [ class classes ] [ text name ]
|
||||||
|
|
||||||
|
Just website ->
|
||||||
|
a [ href website, target "_blank", class classes ] [ text name ]
|
||||||
|
|
||||||
|
|
||||||
closeablePanelheading : String -> String -> String -> Msg -> Html Msg
|
closeablePanelheading : String -> String -> String -> Msg -> Html Msg
|
||||||
closeablePanelheading context iconName label onClose =
|
closeablePanelheading context iconName label onClose =
|
||||||
div [ class "panel-heading" ]
|
div [ class "panel-heading" ]
|
||||||
|
@ -99,7 +99,7 @@ notificationStatusView ( context, currentUser, status, { type_, accounts } ) =
|
|||||||
_ ->
|
_ ->
|
||||||
text ""
|
text ""
|
||||||
, Lazy.lazy2 statusView context status
|
, Lazy.lazy2 statusView context status
|
||||||
, Lazy.lazy2 statusActionsView status currentUser
|
, Lazy.lazy3 statusActionsView status currentUser False
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -84,8 +84,8 @@ attachmentListView context { media_attachments, sensitive } =
|
|||||||
List.map (keyedEntry attachments) attachments
|
List.map (keyedEntry attachments) attachments
|
||||||
|
|
||||||
|
|
||||||
statusActionsView : Status -> CurrentUser -> Html Msg
|
statusActionsView : Status -> CurrentUser -> Bool -> Html Msg
|
||||||
statusActionsView status currentUser =
|
statusActionsView status currentUser showApp =
|
||||||
let
|
let
|
||||||
sourceStatus =
|
sourceStatus =
|
||||||
Mastodon.Helper.extractReblog status
|
Mastodon.Helper.extractReblog status
|
||||||
@ -119,8 +119,7 @@ statusActionsView status currentUser =
|
|||||||
div [ class "btn-group actions" ]
|
div [ class "btn-group actions" ]
|
||||||
[ a
|
[ a
|
||||||
[ class baseBtnClasses
|
[ class baseBtnClasses
|
||||||
, onClickWithPreventAndStop <|
|
, onClickWithPreventAndStop <| DraftEvent (UpdateReplyTo status)
|
||||||
DraftEvent (UpdateReplyTo status)
|
|
||||||
]
|
]
|
||||||
[ Common.icon "share-alt" ]
|
[ Common.icon "share-alt" ]
|
||||||
, if status.visibility == "private" then
|
, if status.visibility == "private" then
|
||||||
@ -131,20 +130,17 @@ statusActionsView status currentUser =
|
|||||||
[ span [ title "Direct" ] [ Common.icon "envelope" ] ]
|
[ span [ title "Direct" ] [ Common.icon "envelope" ] ]
|
||||||
else
|
else
|
||||||
a
|
a
|
||||||
[ class reblogClasses
|
[ class reblogClasses, onClickWithPreventAndStop reblogEvent ]
|
||||||
, onClickWithPreventAndStop reblogEvent
|
|
||||||
]
|
|
||||||
[ Common.icon "fire", text (toString sourceStatus.reblogs_count) ]
|
[ Common.icon "fire", text (toString sourceStatus.reblogs_count) ]
|
||||||
, a
|
, a
|
||||||
[ class favClasses
|
[ class favClasses, onClickWithPreventAndStop favEvent ]
|
||||||
, onClickWithPreventAndStop favEvent
|
|
||||||
]
|
|
||||||
[ Common.icon "star", text (toString sourceStatus.favourites_count) ]
|
[ Common.icon "star", text (toString sourceStatus.favourites_count) ]
|
||||||
, if Mastodon.Helper.sameAccount sourceStatus.account currentUser then
|
, if Mastodon.Helper.sameAccount sourceStatus.account currentUser then
|
||||||
a
|
a
|
||||||
[ class <| baseBtnClasses ++ " btn-delete"
|
[ class <| baseBtnClasses ++ " btn-delete"
|
||||||
, href ""
|
, href ""
|
||||||
, onClickWithPreventAndStop <| AskConfirm "Are you sure you want to delete this toot?" (DeleteStatus sourceStatus.id) NoOp
|
, onClickWithPreventAndStop <|
|
||||||
|
AskConfirm "Are you sure you want to delete this toot?" (DeleteStatus sourceStatus.id) NoOp
|
||||||
]
|
]
|
||||||
[ Common.icon "trash" ]
|
[ Common.icon "trash" ]
|
||||||
else
|
else
|
||||||
@ -152,6 +148,10 @@ statusActionsView status currentUser =
|
|||||||
, a
|
, a
|
||||||
[ class baseBtnClasses, href (Maybe.withDefault "#" status.url), target "_blank" ]
|
[ class baseBtnClasses, href (Maybe.withDefault "#" status.url), target "_blank" ]
|
||||||
[ Common.icon "time", formatDate ]
|
[ Common.icon "time", formatDate ]
|
||||||
|
, if showApp then
|
||||||
|
Common.appLink (baseBtnClasses ++ " applink") status.application
|
||||||
|
else
|
||||||
|
text ""
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@ -205,7 +205,7 @@ statusEntryView context className currentUser status =
|
|||||||
in
|
in
|
||||||
li liAttributes
|
li liAttributes
|
||||||
[ Lazy.lazy2 statusView context status
|
[ Lazy.lazy2 statusView context status
|
||||||
, Lazy.lazy2 statusActionsView status currentUser
|
, Lazy.lazy3 statusActionsView status currentUser (className == "thread-target")
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user