[mastodon-client] Accept both types and exclude_types at the same time in GET /v1/notifications

This ensures compatibility with Mastodon for Android and its forks
This commit is contained in:
Laura Hausmann 2023-10-07 19:16:01 +02:00
parent 1cb935f483
commit 8bec41b554
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -8,7 +8,6 @@ import { LinkPaginationObject } from "@/server/api/mastodon/middleware/paginatio
export class NotificationHelpers { export class NotificationHelpers {
public static async getNotifications(user: ILocalUser, maxId: string | undefined, sinceId: string | undefined, minId: string | undefined, limit: number = 40, types: string[] | undefined, excludeTypes: string[] | undefined, accountId: string | undefined): Promise<LinkPaginationObject<Notification[]>> { public static async getNotifications(user: ILocalUser, maxId: string | undefined, sinceId: string | undefined, minId: string | undefined, limit: number = 40, types: string[] | undefined, excludeTypes: string[] | undefined, accountId: string | undefined): Promise<LinkPaginationObject<Notification[]>> {
if (limit > 80) limit = 80; if (limit > 80) limit = 80;
if (types && excludeTypes) throw new Error("types and exclude_types can not be used simultaneously");
let requestedTypes = types let requestedTypes = types
? this.decodeTypes(types) ? this.decodeTypes(types)