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
|
type NotificationFilter
|
||||||
= NotificationAll
|
= NotificationAll
|
||||||
| NotificationOnlyMentions
|
| NotificationOnlyMentions
|
||||||
|
| NotificationOnlyDirect
|
||||||
| NotificationOnlyBoosts
|
| NotificationOnlyBoosts
|
||||||
| NotificationOnlyFavourites
|
| NotificationOnlyFavourites
|
||||||
| NotificationOnlyFollows
|
| NotificationOnlyFollows
|
||||||
|
|
|
@ -20,22 +20,34 @@ type alias CurrentUser =
|
||||||
filterNotifications : NotificationFilter -> List NotificationAggregate -> List NotificationAggregate
|
filterNotifications : NotificationFilter -> List NotificationAggregate -> List NotificationAggregate
|
||||||
filterNotifications filter notifications =
|
filterNotifications filter notifications =
|
||||||
let
|
let
|
||||||
applyFilter { type_ } =
|
applyFilter { type_, status } =
|
||||||
case filter of
|
let
|
||||||
NotificationAll ->
|
visibility =
|
||||||
True
|
case status of
|
||||||
|
Just status ->
|
||||||
|
status.visibility
|
||||||
|
|
||||||
NotificationOnlyMentions ->
|
Nothing ->
|
||||||
type_ == "mention"
|
""
|
||||||
|
in
|
||||||
|
case filter of
|
||||||
|
NotificationAll ->
|
||||||
|
True
|
||||||
|
|
||||||
NotificationOnlyBoosts ->
|
NotificationOnlyMentions ->
|
||||||
type_ == "reblog"
|
type_ == "mention" && visibility /= "direct"
|
||||||
|
|
||||||
NotificationOnlyFavourites ->
|
NotificationOnlyDirect ->
|
||||||
type_ == "favourite"
|
type_ == "mention" && visibility == "direct"
|
||||||
|
|
||||||
NotificationOnlyFollows ->
|
NotificationOnlyBoosts ->
|
||||||
type_ == "follow"
|
type_ == "reblog"
|
||||||
|
|
||||||
|
NotificationOnlyFavourites ->
|
||||||
|
type_ == "favourite"
|
||||||
|
|
||||||
|
NotificationOnlyFollows ->
|
||||||
|
type_ == "follow"
|
||||||
in
|
in
|
||||||
if filter == NotificationAll then
|
if filter == NotificationAll then
|
||||||
notifications
|
notifications
|
||||||
|
@ -124,6 +136,7 @@ notificationFilterView filter =
|
||||||
Common.justifiedButtonGroup "notification-filters"
|
Common.justifiedButtonGroup "notification-filters"
|
||||||
[ filterBtn "All notifications" "asterisk" NotificationAll
|
[ filterBtn "All notifications" "asterisk" NotificationAll
|
||||||
, filterBtn "Mentions" "share-alt" NotificationOnlyMentions
|
, filterBtn "Mentions" "share-alt" NotificationOnlyMentions
|
||||||
|
, filterBtn "Direct" "envelope" NotificationOnlyDirect
|
||||||
, filterBtn "Boosts" "fire" NotificationOnlyBoosts
|
, filterBtn "Boosts" "fire" NotificationOnlyBoosts
|
||||||
, filterBtn "Favorites" "star" NotificationOnlyFavourites
|
, filterBtn "Favorites" "star" NotificationOnlyFavourites
|
||||||
, filterBtn "Follows" "user" NotificationOnlyFollows
|
, filterBtn "Follows" "user" NotificationOnlyFollows
|
||||||
|
|
Loading…
Reference in New Issue