Fix streaming and handling of quoted_update notifications (#35924)

This commit is contained in:
Claire 2025-08-27 16:53:54 +02:00 committed by GitHub
parent c2b7b28919
commit a6a0d982ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 20 additions and 8 deletions

View File

@ -30,9 +30,20 @@ import { importFetchedAccounts, importFetchedStatuses } from './importer';
import { NOTIFICATIONS_FILTER_SET } from './notifications'; import { NOTIFICATIONS_FILTER_SET } from './notifications';
import { saveSettings } from './settings'; import { saveSettings } from './settings';
function notificationTypeForFilter(type: NotificationType) {
if (type === 'quoted_update') return 'update';
else return type;
}
function notificationTypeForQuickFilter(type: NotificationType) {
if (type === 'quoted_update') return 'update';
else if (type === 'quote') return 'mention';
else return type;
}
function excludeAllTypesExcept(filter: string) { function excludeAllTypesExcept(filter: string) {
return allNotificationTypes.filter( return allNotificationTypes.filter(
(item) => item !== filter && !(item === 'quote' && filter === 'mention'), (item) => notificationTypeForQuickFilter(item) !== filter,
); );
} }
@ -157,16 +168,17 @@ export const processNewNotificationForGroups = createAppAsyncThunk(
const showInColumn = const showInColumn =
activeFilter === 'all' activeFilter === 'all'
? notificationShows[notification.type] !== false ? notificationShows[notificationTypeForFilter(notification.type)] !==
: activeFilter === notification.type || false
(activeFilter === 'mention' && notification.type === 'quote'); : activeFilter === notificationTypeForQuickFilter(notification.type);
if (!showInColumn) return; if (!showInColumn) return;
if ( if (
(notification.type === 'mention' || (notification.type === 'mention' ||
notification.type === 'quote' ||
notification.type === 'update' || notification.type === 'update' ||
notification.type === 'quote') && notification.type === 'quoted_update') &&
notification.status?.filtered notification.status?.filtered
) { ) {
const filters = notification.status.filtered.filter((result) => const filters = notification.status.filtered.filter((result) =>

View File

@ -31,7 +31,7 @@ export function updateNotifications(notification, intlMessages, intlLocale) {
let filtered = false; let filtered = false;
if (['mention', 'status', 'quote'].includes(notification.type) && notification.status.filtered) { if (['mention', 'quote', 'status'].includes(notification.type) && notification.status.filtered) {
const filters = notification.status.filtered.filter(result => result.filter.context.includes('notifications')); const filters = notification.status.filtered.filter(result => result.filter.context.includes('notifications'));
if (filters.some(result => result.filter.filter_action === 'hide')) { if (filters.some(result => result.filter.filter_action === 'hide')) {

View File

@ -7,7 +7,7 @@ import type { ApiReportJSON } from './reports';
import type { ApiStatusJSON } from './statuses'; import type { ApiStatusJSON } from './statuses';
// See app/model/notification.rb // See app/model/notification.rb
export const allNotificationTypes = [ export const allNotificationTypes: NotificationType[] = [
'follow', 'follow',
'follow_request', 'follow_request',
'favourite', 'favourite',

View File

@ -21,7 +21,7 @@ class REST::NotificationSerializer < ActiveModel::Serializer
end end
def status_type? def status_type?
[:favourite, :reblog, :status, :mention, :poll, :update, :quote].include?(object.type) [:favourite, :reblog, :status, :mention, :poll, :update, :quoted_update, :quote].include?(object.type)
end end
def report_type? def report_type?