1
0
Fork 0

Follow request notifications

I'm not sure why the other clients don't have these. I want them!
This commit is contained in:
Ryan Fox 2021-01-12 21:06:13 +00:00
parent 3814ee8f62
commit dae4d98f54
Signed by: flewkey
GPG Key ID: 94F56ADFD848851E
4 changed files with 19 additions and 4 deletions

View File

@ -762,6 +762,14 @@ notifyNotification notification =
, clickUrl = "#account/" ++ notification.account.id
}
"follow_request" ->
Ports.notify
{ title = notification.account.acct ++ " sent you a follow request"
, icon = notification.account.avatar
, body = notification.account.note
, clickUrl = "#account/" ++ notification.account.id
}
_ ->
Cmd.none

View File

@ -176,6 +176,7 @@ aggregateNotifications notifications =
, notifications |> only "favourite" |> groupWhile sameStatus |> aggregate
, notifications |> only "mention" |> groupWhile sameStatus |> aggregate
, notifications |> only "follow" |> groupWhile (\_ _ -> True) |> aggregate
, notifications |> only "follow_request" |> groupWhile (\_ _ -> True) |> aggregate
]
|> List.concat
|> List.sortBy .created_at

View File

@ -166,7 +166,7 @@ type alias Mention =
type alias Notification =
{-
- id: The notification ID
- type_: One of: "mention", "reblog", "favourite", "follow"
- type_: One of: "mention", "reblog", "favourite", "follow", "follow_request", "poll", "status"
- created_at: The time the notification was created
- account: The Account sending the notification to the user
- status: The Status associated with the notification, if applicable

View File

@ -47,7 +47,7 @@ filterNotifications filter notifications =
type_ == "favourite"
NotificationOnlyFollows ->
type_ == "follow"
type_ == "follow" || type_ == "follow_request"
in
if filter == NotificationAll then
notifications
@ -105,7 +105,7 @@ notificationStatusView ( context, currentUser, status, { type_, accounts } ) =
notificationFollowView : CurrentUser -> NotificationAggregate -> Html Msg
notificationFollowView currentUser { accounts } =
notificationFollowView currentUser { type_, accounts } =
let
profileView : AccountNotificationDate -> Html Msg
profileView { account, created_at } =
@ -122,9 +122,15 @@ notificationFollowView currentUser { accounts } =
, onClick <| Navigate ("#account/" ++ account.id)
]
]
message =
if type_ == "follow_request" then
"sent you a follow request"
else
"started following you"
in
div [ class "notification follow" ]
[ notificationHeading accounts "started following you" "user"
[ notificationHeading accounts message "user"
, div [ class "" ] <| List.map profileView (List.take 3 accounts)
]