]> cat aescling's git repositories - mastodon.git/commitdiff
Add option to opt out of unread notification markers
authorClaire <claire.github-309c@sitedethib.com>
Fri, 19 Mar 2021 11:47:31 +0000 (12:47 +0100)
committerClaire <claire.github-309c@sitedethib.com>
Fri, 19 Mar 2021 12:57:32 +0000 (13:57 +0100)
Port 55ac2b9c6085def9e692fa69b849239c1249d9fd to glitch-soc

app/javascript/flavours/glitch/features/notifications/components/column_settings.js
app/javascript/flavours/glitch/features/notifications/index.js
app/javascript/flavours/glitch/reducers/settings.js

index e502c3173f748ea7eb11165f0ebe3556712bcb19..0676963326d831f4e3e54d9b5cc62855a0e1a31d 100644 (file)
@@ -56,6 +56,16 @@ export default class ColumnSettings extends React.PureComponent {
           <ClearColumnButton onClick={onClear} />
         </div>
 
+        <div role='group' aria-labelledby='notifications-unread-markers'>
+          <span id='notifications-unread-markers' className='column-settings__section'>
+            <FormattedMessage id='notifications.column_settings.unread_markers.category' defaultMessage='Unread notification markers' />
+          </span>
+
+          <div className='column-settings__row'>
+            <SettingToggle id='unread-notification-markers' prefix='notifications' settings={settings} settingPath={['showUnread']} onChange={onChange} label={filterShowStr} />
+          </div>
+        </div>
+
         <div role='group' aria-labelledby='notifications-filter-bar'>
           <span id='notifications-filter-bar' className='column-settings__section'>
             <FormattedMessage id='notifications.column_settings.filter_bar.category' defaultMessage='Quick filter bar' />
index 5ceda9a91ce89d030fd0b5faf506351b39c02ae2..842e023711ec875735ad5e8c305262ef4e5da4f0 100644 (file)
@@ -67,8 +67,8 @@ const mapStateToProps = state => ({
   hasMore: state.getIn(['notifications', 'hasMore']),
   numPending: state.getIn(['notifications', 'pendingItems'], ImmutableList()).size,
   notifCleaningActive: state.getIn(['notifications', 'cleaningMode']),
-  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),
+  lastReadId: state.getIn(['settings', 'notifications', 'showUnread']) ? state.getIn(['notifications', 'readMarkerId']) : '0',
+  canMarkAsRead: state.getIn(['settings', 'notifications', 'showUnread']) && 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' && !state.getIn(['settings', 'notifications', 'dismissPermissionBanner']),
 });
 
index 091b8feecf009448b37b080e4dca1ddf2150b78d..a53d34a83d028b2b2ce8c69d499cc50b963a99a1 100644 (file)
@@ -49,6 +49,7 @@ const initialState = ImmutableMap({
     }),
 
     dismissPermissionBanner: false,
+    showUnread: true,
 
     shows: ImmutableMap({
       follow: true,