mirror of https://github.com/tootsuite/mastodon
change getNotifications to use filter
parent
7b00332167
commit
b8705a7bf2
|
@ -23,8 +23,8 @@ export default class FilterBar extends React.PureComponent {
|
|||
/>
|
||||
</button>
|
||||
<button
|
||||
className={selectedFilter === 'mentions' ? 'active' : ''}
|
||||
onClick={() => selectFilter('mentions')}
|
||||
className={selectedFilter === 'mention' ? 'active' : ''}
|
||||
onClick={() => selectFilter('mention')}
|
||||
>
|
||||
<FormattedMessage
|
||||
id='notifications.filter.mentions'
|
||||
|
@ -32,8 +32,8 @@ export default class FilterBar extends React.PureComponent {
|
|||
/>
|
||||
</button>
|
||||
<button
|
||||
className={selectedFilter === 'favourites' ? 'active' : ''}
|
||||
onClick={() => selectFilter('favourites')}
|
||||
className={selectedFilter === 'favourite' ? 'active' : ''}
|
||||
onClick={() => selectFilter('favourite')}
|
||||
>
|
||||
<FormattedMessage
|
||||
id='notifications.filter.favourites'
|
||||
|
@ -41,8 +41,8 @@ export default class FilterBar extends React.PureComponent {
|
|||
/>
|
||||
</button>
|
||||
<button
|
||||
className={selectedFilter === 'boosts' ? 'active' : ''}
|
||||
onClick={() => selectFilter('boosts')}
|
||||
className={selectedFilter === 'reblog' ? 'active' : ''}
|
||||
onClick={() => selectFilter('reblog')}
|
||||
>
|
||||
<FormattedMessage
|
||||
id='notifications.filter.boosts'
|
||||
|
@ -50,8 +50,8 @@ export default class FilterBar extends React.PureComponent {
|
|||
/>
|
||||
</button>
|
||||
<button
|
||||
className={selectedFilter === 'follows' ? 'active' : ''}
|
||||
onClick={() => selectFilter('follows')}
|
||||
className={selectedFilter === 'follow' ? 'active' : ''}
|
||||
onClick={() => selectFilter('follow')}
|
||||
>
|
||||
<FormattedMessage
|
||||
id='notifications.filter.follows'
|
||||
|
|
|
@ -20,11 +20,16 @@ const messages = defineMessages({
|
|||
title: { id: 'column.notifications', defaultMessage: 'Notifications' },
|
||||
});
|
||||
|
||||
// TODO: Modify this to filter notifications
|
||||
const getNotifications = createSelector([
|
||||
state => state.getIn(['settings', 'notifications', 'filter']),
|
||||
state => ImmutableList(state.getIn(['settings', 'notifications', 'shows']).filter(item => !item).keys()),
|
||||
state => state.getIn(['notifications', 'items']),
|
||||
], (excludedTypes, notifications) => notifications.filterNot(item => item !== null && excludedTypes.includes(item.get('type'))));
|
||||
], (allowedType, excludedTypes, notifications) => {
|
||||
if (allowedType === 'all') {
|
||||
return notifications.filterNot(item => item !== null && excludedTypes.includes(item.get('type')));
|
||||
}
|
||||
return notifications.filter(item => item !== null && allowedType === item.get('type'))
|
||||
});
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
notifications: getNotifications(state),
|
||||
|
|
Loading…
Reference in New Issue