1
0
Fork 0

Fixed #166: Limit number of accounts in notifications.

This commit is contained in:
Nicolas Perriault 2017-05-14 10:30:59 +02:00
parent 4d8757ad7c
commit 2d0d5cd7b9
No known key found for this signature in database
GPG Key ID: DA5E4C83904F7A2A
2 changed files with 29 additions and 11 deletions

View File

@ -113,7 +113,7 @@ addNotificationToAggregates notification aggregates =
in
{-
If we did no modification to the old aggregates it's
because we didn't found any match. So me have to create
because we didn't found any match. So we have to create
a new aggregate
-}
if newAggregates == aggregates then

View File

@ -57,15 +57,33 @@ filterNotifications filter notifications =
notificationHeading : List Account -> String -> String -> Html Msg
notificationHeading accounts str iconType =
div [ class "status-info" ]
[ div [ class "avatars" ] <| List.map (Common.accountAvatarLink False) accounts
, p [ class "status-info-text" ] <|
List.intersperse (text " ")
[ Common.icon iconType
, span [] <| List.intersperse (text ", ") (List.map (Common.accountLink False) accounts)
, text str
]
]
let
( firstAccounts, finalStr ) =
case accounts of
[ a1 ] ->
( [ a1 ], str )
[ a1, a2 ] ->
( [ a1, a2 ], str )
[ a1, a2, a3 ] ->
( [ a1, a2, a3 ], str )
a1 :: a2 :: a3 :: xs ->
( [ a1, a2, a3 ], " and " ++ (toString <| List.length xs) ++ " others " ++ str )
_ ->
( [], "" )
in
div [ class "status-info" ]
[ div [ class "avatars" ] <| List.map (Common.accountAvatarLink False) accounts
, p [ class "status-info-text" ] <|
List.intersperse (text " ")
[ Common.icon iconType
, span [] <| List.intersperse (text ", ") (List.map (Common.accountLink False) firstAccounts)
, text finalStr
]
]
notificationStatusView : ( String, CurrentUser, Status, NotificationAggregate ) -> Html Msg
@ -102,7 +120,7 @@ notificationFollowView currentUser { accounts } =
in
div [ class "notification follow" ]
[ notificationHeading accounts "started following you" "user"
, div [ class "" ] <| List.map profileView accounts
, div [ class "" ] <| List.map profileView (List.take 3 accounts)
]