mirror of
https://git.shipoclu.com/moon/plspace.git
synced 2026-08-13 02:42:30 +00:00
egregoros compat
This commit is contained in:
@@ -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>> {
|
||||
|
||||
Reference in New Issue
Block a user