Fix #58: Add a direct message filter button.
This commit is contained in:
parent
1fc6d6b4a2
commit
93e42ac575
@ -153,6 +153,7 @@ type alias Draft =
|
||||
type NotificationFilter
|
||||
= NotificationAll
|
||||
| NotificationOnlyMentions
|
||||
| NotificationOnlyDirect
|
||||
| NotificationOnlyBoosts
|
||||
| NotificationOnlyFavourites
|
||||
| NotificationOnlyFollows
|
||||
|
@ -20,22 +20,34 @@ type alias CurrentUser =
|
||||
filterNotifications : NotificationFilter -> List NotificationAggregate -> List NotificationAggregate
|
||||
filterNotifications filter notifications =
|
||||
let
|
||||
applyFilter { type_ } =
|
||||
case filter of
|
||||
NotificationAll ->
|
||||
True
|
||||
applyFilter { type_, status } =
|
||||
let
|
||||
visibility =
|
||||
case status of
|
||||
Just status ->
|
||||
status.visibility
|
||||
|
||||
NotificationOnlyMentions ->
|
||||
type_ == "mention"
|
||||
Nothing ->
|
||||
""
|
||||
in
|
||||
case filter of
|
||||
NotificationAll ->
|
||||
True
|
||||
|
||||
NotificationOnlyBoosts ->
|
||||
type_ == "reblog"
|
||||
NotificationOnlyMentions ->
|
||||
type_ == "mention" && visibility /= "direct"
|
||||
|
||||
NotificationOnlyFavourites ->
|
||||
type_ == "favourite"
|
||||
NotificationOnlyDirect ->
|
||||
type_ == "mention" && visibility == "direct"
|
||||
|
||||
NotificationOnlyFollows ->
|
||||
type_ == "follow"
|
||||
NotificationOnlyBoosts ->
|
||||
type_ == "reblog"
|
||||
|
||||
NotificationOnlyFavourites ->
|
||||
type_ == "favourite"
|
||||
|
||||
NotificationOnlyFollows ->
|
||||
type_ == "follow"
|
||||
in
|
||||
if filter == NotificationAll then
|
||||
notifications
|
||||
@ -124,6 +136,7 @@ notificationFilterView filter =
|
||||
Common.justifiedButtonGroup "notification-filters"
|
||||
[ filterBtn "All notifications" "asterisk" NotificationAll
|
||||
, filterBtn "Mentions" "share-alt" NotificationOnlyMentions
|
||||
, filterBtn "Direct" "envelope" NotificationOnlyDirect
|
||||
, filterBtn "Boosts" "fire" NotificationOnlyBoosts
|
||||
, filterBtn "Favorites" "star" NotificationOnlyFavourites
|
||||
, filterBtn "Follows" "user" NotificationOnlyFollows
|
||||
|
Loading…
Reference in New Issue
Block a user