egregoros compat

This commit is contained in:
Moon.eth
2026-07-29 20:59:52 +09:00
parent 081460c7f6
commit 5b7b4360d2
16 changed files with 713 additions and 137 deletions
+9 -2
View File
@@ -330,14 +330,21 @@ export async function uploadMedia(api: ApiClient, file: File, description?: stri
/* ------------------------------------------------------------- mail centre */
export function fetchNotifications(
export async function fetchNotifications(
api: ApiClient,
cursor: Cursor = {},
types?: string[],
): Promise<Page<Notification>> {
const query: Query = { ...cursor }
if (types?.length) query.types = types
return api.page<Notification>('/api/v1/notifications', query)
const page = await api.page<Notification>('/api/v1/notifications', query)
if (!types?.length) return page
// Egregoros currently accepts but ignores `types[]`. Apply the same filter
// locally so Mail folders remain correct; this is harmless when the server
// already filtered the page.
const allowed = new Set(types)
return { ...page, items: page.items.filter((notification) => allowed.has(notification.type)) }
}
export function fetchFollowRequests(api: ApiClient, cursor: Cursor = {}): Promise<Page<Account>> {