From 0a4eaecd0e432beefb64f9147580f9bc9f843165 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Sun, 17 Sep 2023 20:53:09 -0700 Subject: feat(notifications): link to thread for threads --- src/lib/AniList/notifications.ts | 3 ++- src/routes/feeds/activity-notifications/+server.ts | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lib/AniList/notifications.ts b/src/lib/AniList/notifications.ts index 671f2146..b236e994 100644 --- a/src/lib/AniList/notifications.ts +++ b/src/lib/AniList/notifications.ts @@ -7,6 +7,7 @@ export interface Notification { }; thread: { title: string; + id: number; }; context: string; id: number; @@ -31,7 +32,7 @@ export const notifications = async (accessToken: string): Promise `... on ${type} { - id user { name avatar { large } } context createdAt type thread { title } + id user { name avatar { large } } context createdAt type thread { title id } }`; return ( diff --git a/src/routes/feeds/activity-notifications/+server.ts b/src/routes/feeds/activity-notifications/+server.ts index 249ba985..e72482e8 100644 --- a/src/routes/feeds/activity-notifications/+server.ts +++ b/src/routes/feeds/activity-notifications/+server.ts @@ -20,6 +20,7 @@ export const GET = async ({ url }) => { ${posts .map((notification: Notification) => { let title = `${notification.user.name} ${notification.context}`; + let link = `https://anilist.co/user/${notification.user.name}`; const prettyType = notification.type .toString() .replace(/_/g, ' ') @@ -30,12 +31,13 @@ export const GET = async ({ url }) => { if (notification.type.toString().includes('THREAD')) { title += `${notification.thread.title}`; + link = `https://anilist.co/forum/thread/${notification.thread.id}`; } return ` ${notification.id} ${title} -https://anilist.co/user/${notification.user.name} +${link} ${notification.user.name} ${prettyType} -- cgit v1.2.3