1
0
Fork 0

Display usernames in notifications Mastodon-like

This commit is contained in:
Ryan Fox 2021-01-10 22:09:11 +00:00
parent 4934e38465
commit d1dc4e1c67
Signed by: flewkey
GPG Key ID: 94F56ADFD848851E
2 changed files with 35 additions and 2 deletions

View File

@ -3,6 +3,7 @@ module View.Common
( accountAvatar ( accountAvatar
, accountAvatarLink , accountAvatarLink
, accountLink , accountLink
, accountLinkSmall
, appLink , appLink
, closeablePanelheading , closeablePanelheading
, icon , icon
@ -45,6 +46,27 @@ accountLink external account =
[ text <| "@" ++ account.acct ] [ text <| "@" ++ account.acct ]
accountLinkSmall : Bool -> Account -> Html Msg
accountLinkSmall external account =
let
accountHref =
if external then
target "_blank"
else
href <| "#account/" ++ account.id
in
a
[ href account.url
, accountHref
]
[ text <|
if account.display_name == "" then
account.username
else
account.display_name
]
accountAvatarLink : Bool -> Account -> Html Msg accountAvatarLink : Bool -> Account -> Html Msg
accountAvatarLink external account = accountAvatarLink external account =
let let

View File

@ -81,7 +81,7 @@ notificationHeading accountsAndDate str iconType =
, p [ class "status-info-text" ] <| , p [ class "status-info-text" ] <|
List.intersperse (text " ") List.intersperse (text " ")
[ Common.icon iconType [ Common.icon iconType
, span [] <| List.intersperse (text ", ") (List.map (Common.accountLink False) firstAccounts) , span [] <| List.intersperse (text ", ") (List.map (Common.accountLinkSmall False) firstAccounts)
, text finalStr , text finalStr
] ]
] ]
@ -112,7 +112,18 @@ notificationFollowView currentUser { accounts } =
div [ class "status follow-profile" ] div [ class "status follow-profile" ]
[ Common.accountAvatarLink False account [ Common.accountAvatarLink False account
, div [ class "username" ] , div [ class "username" ]
[ Common.accountLink False account [
a
[ href <| "#account/" ++ account.id
]
[ text <|
if account.display_name == "" then
account.username
else
account.display_name
, br [] []
, span [ class "acct" ] [ text <| "@" ++ account.acct ]
]
, span [ class "btn-sm follow-profile-date" ] , span [ class "btn-sm follow-profile-date" ]
[ Common.icon "time", text <| Common.formatDate created_at ] [ Common.icon "time", text <| Common.formatDate created_at ]
] ]