Collection notification filtering (#39198)
This commit is contained in:
9 files changed
+218
-8
No files matched your search
@@ -29,7 +29,10 @@ const filterNotificationsByAllowedTypes = (
|
||||
(item) =>
|
||||
item.type === 'gap' ||
|
||||
allowedType === item.type ||
|
||||
(allowedType === 'mention' && item.type === 'quote'),
|
||||
(allowedType === 'mention' && item.type === 'quote') ||
|
||||
(allowedType === 'collection' &&
|
||||
(item.type === 'collection_update' ||
|
||||
item.type === 'added_to_collection')),
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -17,10 +17,19 @@ export const selectSettingsNotificationsShows = createSelector(
|
||||
|
||||
export const selectSettingsNotificationsExcludedTypes = createSelector(
|
||||
[selectSettingsNotificationsShows],
|
||||
(shows) =>
|
||||
Object.entries(shows)
|
||||
.filter(([_type, enabled]) => !enabled)
|
||||
.map(([type, _enabled]) => type),
|
||||
(shows) => {
|
||||
const excludedTypes: string[] = [];
|
||||
for (const key in shows) {
|
||||
if (!shows[key]) {
|
||||
if (key === 'collections') {
|
||||
excludedTypes.push('collection_update', 'added_to_collection');
|
||||
} else {
|
||||
excludedTypes.push(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
return excludedTypes;
|
||||
},
|
||||
);
|
||||
|
||||
export const selectSettingsNotificationsQuickFilterShow = (state: RootState) =>
|
||||
|
||||
Reference in new issue
Block a user