Notifications: exclude chat messages from "All" filter, improve exclude_types fallback
This commit is contained in:
parent
68f153d7fa
commit
de4f1aaabf
2 changed files with 11 additions and 2 deletions
|
@ -11,7 +11,7 @@ import { getFilters, regexFromFilters } from 'soapbox/selectors';
|
|||
import { isLoggedIn } from 'soapbox/utils/auth';
|
||||
import { getFeatures, parseVersion, PLEROMA } from 'soapbox/utils/features';
|
||||
import { unescapeHTML } from 'soapbox/utils/html';
|
||||
import { NOTIFICATION_TYPES } from 'soapbox/utils/notification';
|
||||
import { EXCLUDE_TYPES, NOTIFICATION_TYPES } from 'soapbox/utils/notification';
|
||||
import { joinPublicPath } from 'soapbox/utils/static';
|
||||
|
||||
import { fetchRelationships } from './accounts';
|
||||
|
@ -195,7 +195,9 @@ const expandNotifications = ({ maxId }: Record<string, any> = {}, done: () => an
|
|||
|
||||
if (activeFilter === 'all') {
|
||||
if (features.notificationsIncludeTypes) {
|
||||
params.types = NOTIFICATION_TYPES;
|
||||
params.types = NOTIFICATION_TYPES.filter(type => !EXCLUDE_TYPES.includes(type as any));
|
||||
} else {
|
||||
params.exclude_types = EXCLUDE_TYPES;
|
||||
}
|
||||
} else {
|
||||
if (features.notificationsIncludeTypes) {
|
||||
|
|
|
@ -14,6 +14,12 @@ const NOTIFICATION_TYPES = [
|
|||
'update',
|
||||
] as const;
|
||||
|
||||
/** Notification types to exclude from the "All" filter by default. */
|
||||
const EXCLUDE_TYPES = [
|
||||
'pleroma:chat_mention',
|
||||
'chat', // TruthSocial
|
||||
] as const;
|
||||
|
||||
type NotificationType = typeof NOTIFICATION_TYPES[number];
|
||||
|
||||
/** Ensure the Notification is a valid, known type. */
|
||||
|
@ -21,6 +27,7 @@ const validType = (type: string): type is NotificationType => NOTIFICATION_TYPES
|
|||
|
||||
export {
|
||||
NOTIFICATION_TYPES,
|
||||
EXCLUDE_TYPES,
|
||||
NotificationType,
|
||||
validType,
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue