aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorFuwn <[email protected]>2023-09-17 22:50:42 -0700
committerFuwn <[email protected]>2023-09-17 22:50:42 -0700
commit672f700271ee935ea9f6bf66802517e720c3c097 (patch)
tree4a0e9ec0456a6d8d27863dd70bd0ae04226af310 /src/lib
parentfeat(anime): bold if releasing soon (diff)
downloaddue.moe-672f700271ee935ea9f6bf66802517e720c3c097.tar.xz
due.moe-672f700271ee935ea9f6bf66802517e720c3c097.zip
feat(notifications): link to activity
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/AniList/notifications.ts28
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')}