Add moved account indicator
This commit is contained in:
parent
e0777847a8
commit
e708f7197a
|
@ -667,6 +667,14 @@ input.form-control[type=file] {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Account rules */
|
/* Account rules */
|
||||||
|
.account-notice {
|
||||||
|
padding: 8px 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.inactive .account-detail, .inactive account-fields, .inactive .account-infos {
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
.account-detail {
|
.account-detail {
|
||||||
position: relative;
|
position: relative;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
|
@ -3,6 +3,7 @@ module Mastodon.Decoder
|
||||||
( appRegistrationDecoder
|
( appRegistrationDecoder
|
||||||
, accessTokenDecoder
|
, accessTokenDecoder
|
||||||
, accountDecoder
|
, accountDecoder
|
||||||
|
, accountMovedDecoder
|
||||||
, attachmentDecoder
|
, attachmentDecoder
|
||||||
, contextDecoder
|
, contextDecoder
|
||||||
, decodeWebSocketMessage
|
, decodeWebSocketMessage
|
||||||
|
@ -104,6 +105,33 @@ accountDecoder =
|
||||||
}
|
}
|
||||||
|> Pipe.optional "emojis" (Decode.list emojiDecoder) []
|
|> Pipe.optional "emojis" (Decode.list emojiDecoder) []
|
||||||
|> Pipe.optional "fields" (Decode.list fieldDecoder) []
|
|> Pipe.optional "fields" (Decode.list fieldDecoder) []
|
||||||
|
|> Pipe.optional "moved" accountMovedDecoder
|
||||||
|
{ acct = ""
|
||||||
|
, avatar = ""
|
||||||
|
, display_name = ""
|
||||||
|
, header = ""
|
||||||
|
, id = ""
|
||||||
|
, locked = False
|
||||||
|
, bot = False
|
||||||
|
, username = ""
|
||||||
|
, url = ""
|
||||||
|
, note = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
accountMovedDecoder : Decode.Decoder AccountMoved
|
||||||
|
accountMovedDecoder =
|
||||||
|
Pipe.decode AccountMoved
|
||||||
|
|> Pipe.required "acct" Decode.string
|
||||||
|
|> Pipe.optional "avatar" Decode.string ""
|
||||||
|
|> Pipe.optional "display_name" Decode.string ""
|
||||||
|
|> Pipe.optional "header" Decode.string ""
|
||||||
|
|> Pipe.required "id" idDecoder
|
||||||
|
|> Pipe.optional "locked" Decode.bool False
|
||||||
|
|> Pipe.optional "bot" Decode.bool False
|
||||||
|
|> Pipe.required "username" Decode.string
|
||||||
|
|> Pipe.required "url" Decode.string
|
||||||
|
|> Pipe.optional "note" Decode.string ""
|
||||||
|
|
||||||
|
|
||||||
applicationDecoder : Decode.Decoder Application
|
applicationDecoder : Decode.Decoder Application
|
||||||
|
|
|
@ -3,6 +3,7 @@ module Mastodon.Model
|
||||||
( AccessTokenResult
|
( AccessTokenResult
|
||||||
, AppRegistration
|
, AppRegistration
|
||||||
, Account
|
, Account
|
||||||
|
, AccountMoved
|
||||||
, AccountNotificationDate
|
, AccountNotificationDate
|
||||||
, Application
|
, Application
|
||||||
, Attachment
|
, Attachment
|
||||||
|
@ -122,6 +123,22 @@ type alias Account =
|
||||||
, source : Source
|
, source : Source
|
||||||
, emojis : List Emoji
|
, emojis : List Emoji
|
||||||
, fields : List Field
|
, fields : List Field
|
||||||
|
, moved : AccountMoved
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
type alias AccountMoved =
|
||||||
|
-- Minimal account to avoid recursive type alias
|
||||||
|
{ acct : String
|
||||||
|
, avatar : String
|
||||||
|
, display_name : String
|
||||||
|
, header : String
|
||||||
|
, id : AccountId
|
||||||
|
, locked : Bool
|
||||||
|
, bot : Bool
|
||||||
|
, username : String
|
||||||
|
, url : String
|
||||||
|
, note : String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,42 @@ type alias CurrentUserRelation =
|
||||||
Maybe Relationship
|
Maybe Relationship
|
||||||
|
|
||||||
|
|
||||||
|
movedIndicator : Account -> Html Msg
|
||||||
|
movedIndicator account =
|
||||||
|
let
|
||||||
|
displayName account =
|
||||||
|
if account.display_name == "" then
|
||||||
|
account.username
|
||||||
|
else
|
||||||
|
account.display_name
|
||||||
|
in
|
||||||
|
if account.moved.id /= "" then
|
||||||
|
div [ class "account-notice" ]
|
||||||
|
[ p []
|
||||||
|
[ Common.icon "briefcase"
|
||||||
|
, text <| " " ++ displayName account
|
||||||
|
, text " has moved to:"
|
||||||
|
]
|
||||||
|
, div [ class "status" ]
|
||||||
|
[ a
|
||||||
|
[ href
|
||||||
|
<| "#account/" ++ account.moved.id
|
||||||
|
]
|
||||||
|
[ img [ class "avatar", src account.moved.avatar ] []
|
||||||
|
, div [ class "username" ]
|
||||||
|
[ text <| displayName account.moved
|
||||||
|
, br [] []
|
||||||
|
, span [ class "acct" ] [ text <| "@" ++ account.moved.acct ]
|
||||||
|
]
|
||||||
|
, div [ class "status-text" ]
|
||||||
|
( formatContent account.moved.note [] )
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
else
|
||||||
|
text ""
|
||||||
|
|
||||||
|
|
||||||
followButton : CurrentUser -> CurrentUserRelation -> Account -> Html Msg
|
followButton : CurrentUser -> CurrentUserRelation -> Account -> Html Msg
|
||||||
followButton currentUser relationship account =
|
followButton currentUser relationship account =
|
||||||
if Mastodon.Helper.sameAccount account currentUser then
|
if Mastodon.Helper.sameAccount account currentUser then
|
||||||
|
@ -290,8 +326,17 @@ accountView subView currentUser accountInfo =
|
||||||
div [ class "col-md-3 column" ]
|
div [ class "col-md-3 column" ]
|
||||||
[ div [ class "panel panel-default" ]
|
[ div [ class "panel panel-default" ]
|
||||||
[ Common.closeablePanelheading "account" "user" "Account"
|
[ Common.closeablePanelheading "account" "user" "Account"
|
||||||
, div [ id "account", class "timeline" ]
|
, div
|
||||||
[ div
|
[ id "account"
|
||||||
|
, class
|
||||||
|
<| "timeline" ++
|
||||||
|
if account.moved.id /= "" then
|
||||||
|
" inactive"
|
||||||
|
else
|
||||||
|
""
|
||||||
|
]
|
||||||
|
[ movedIndicator account
|
||||||
|
, div
|
||||||
[ class "account-detail"
|
[ class "account-detail"
|
||||||
, style [ ( "background-image", "url('" ++ account.header ++ "')" ),
|
, style [ ( "background-image", "url('" ++ account.header ++ "')" ),
|
||||||
( "background-position", "center" ),
|
( "background-position", "center" ),
|
||||||
|
|
Loading…
Reference in New Issue