diff options
Diffstat (limited to 'src/lib/AniList')
| -rw-r--r-- | src/lib/AniList/notifications.ts | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/src/lib/AniList/notifications.ts b/src/lib/AniList/notifications.ts index b236e994..42b4c84b 100644 --- a/src/lib/AniList/notifications.ts +++ b/src/lib/AniList/notifications.ts @@ -28,12 +28,20 @@ export interface Notification { } export const notifications = async (accessToken: string): Promise<Notification[]> => { - const activityNotification = (type: string) => `... on ${type} { - id user { name avatar { large } } context createdAt type - }`; - const threadNotification = (type: string) => `... on ${type} { - id user { name avatar { large } } context createdAt type thread { title id } + const activityNotification = (type: string, extend = '') => `... on ${type} { + id user { name avatar { large } } context createdAt type ${extend} }`; + const richActivityNotification = (type: string) => + `${activityNotification( + type, + `activity { + ... on TextActivity { id } + ... on ListActivity { id } + ... on MessageActivity { id } + }` + )}`; + const threadNotification = (type: string) => + `${activityNotification(type, `thread { title id }`)}`; return ( await ( @@ -48,11 +56,11 @@ export const notifications = async (accessToken: string): Promise<Notification[] query: `{ Page(page: 1, perPage: 50) { notifications { ${activityNotification('FollowingNotification')} ${activityNotification('ActivityMessageNotification')} - ${activityNotification('ActivityMentionNotification')} - ${activityNotification('ActivityReplyNotification')} - ${activityNotification('ActivityReplySubscribedNotification')} - ${activityNotification('ActivityLikeNotification')} - ${activityNotification('ActivityReplyLikeNotification')} + ${richActivityNotification('ActivityMentionNotification')} + ${richActivityNotification('ActivityReplyNotification')} + ${richActivityNotification('ActivityReplySubscribedNotification')} + ${richActivityNotification('ActivityLikeNotification')} + ${richActivityNotification('ActivityReplyLikeNotification')} ${threadNotification('ThreadCommentMentionNotification')} ${threadNotification('ThreadCommentReplyNotification')} ${threadNotification('ThreadCommentSubscribedNotification')} |