]> cat aescling's git repositories - mastodon.git/commitdiff
Add option to hide notification markers
authorThibaut Girka <thib@sitedethib.com>
Tue, 27 Oct 2020 09:52:50 +0000 (10:52 +0100)
committerThibG <thib@sitedethib.com>
Tue, 27 Oct 2020 10:20:11 +0000 (11:20 +0100)
app/javascript/flavours/glitch/features/local_settings/page/index.js
app/javascript/flavours/glitch/features/notifications/index.js
app/javascript/flavours/glitch/reducers/local_settings.js

index 45d10d154edf0dbc89a6b1040e06f45e5ccd4e40..3af6cbdf61cbac1b3301f81cf1247e0731c6df33 100644 (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>
index af928594d7ea9381d677c3c6a187ef36039a0f18..97434b586b8b49b76fc1ccfdc20f5a8a00d2d9ba 100644 (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',
 });
 
index c115cad6bac15c4c0f96c3fb40938dea365d7607..ea37ae4aa6c5cc9a73419a3f766a9bae8418407f 100644 (file)
@@ -55,6 +55,7 @@ const initialState = ImmutableMap({
   notifications : ImmutableMap({
     favicon_badge : false,
     tab_badge     : true,
+    show_unread   : true,
   }),
 });