Add option to hide notification markers

This commit is contained in:
Thibaut Girka 2020-10-27 10:52:50 +01:00 committed by ThibG
parent c762ca49dc
commit a81bb14abe
3 changed files with 11 additions and 2 deletions

View file

@ -113,6 +113,14 @@ class LocalSettingsPage extends React.PureComponent {
<FormattedMessage id='settings.notifications.favicon_badge' defaultMessage='Unread notifications favicon badge' />
<span className='hint'><FormattedMessage id='settings.notifications.favicon_badge.hint' defaultMessage="Add a badge for unread notifications to the favicon" /></span>
</LocalSettingsPageItem>
<LocalSettingsPageItem
settings={settings}
item={['notifications', 'show_unread']}
id='mastodon-settings--notifications-show_unread'
onChange={onChange}
>
<FormattedMessage id='settings.notifications.show_unread' defaultMessage='Show unread marker' />
</LocalSettingsPageItem>
</section>
<section>
<h2><FormattedMessage id='settings.layout_opts' defaultMessage='Layout options' /></h2>

View file

@ -61,8 +61,8 @@ const mapStateToProps = state => ({
hasMore: state.getIn(['notifications', 'hasMore']),
numPending: state.getIn(['notifications', 'pendingItems'], ImmutableList()).size,
notifCleaningActive: state.getIn(['notifications', 'cleaningMode']),
lastReadId: state.getIn(['notifications', 'readMarkerId']),
canMarkAsRead: state.getIn(['notifications', 'readMarkerId']) !== '0' && getNotifications(state).some(item => item !== null && compareId(item.get('id'), state.getIn(['notifications', 'readMarkerId'])) > 0),
lastReadId: state.getIn(['local_settings', 'notifications', 'show_unread']) ? state.getIn(['notifications', 'readMarkerId']) : '0',
canMarkAsRead: state.getIn(['local_settings', 'notifications', 'show_unread']) && state.getIn(['notifications', 'readMarkerId']) !== '0' && getNotifications(state).some(item => item !== null && compareId(item.get('id'), state.getIn(['notifications', 'readMarkerId'])) > 0),
needsNotificationPermission: state.getIn(['settings', 'notifications', 'alerts']).includes(true) && state.getIn(['notifications', 'browserSupport']) && state.getIn(['notifications', 'browserPermission']) === 'default',
});

View file

@ -55,6 +55,7 @@ const initialState = ImmutableMap({
notifications : ImmutableMap({
favicon_badge : false,
tab_badge : true,
show_unread : true,
}),
});