Notifications: exclude chat messages from "All" filter, improve exclude_types fallback

environments/review-chats-noti-mq31sz/deployments/1288
Alex Gleason 2022-11-04 13:02:23 -05:00
rodzic 68f153d7fa
commit de4f1aaabf
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
2 zmienionych plików z 11 dodań i 2 usunięć

Wyświetl plik

@ -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) {

Wyświetl plik

@ -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,
};