diff options
| author | Fuwn <[email protected]> | 2024-01-03 19:08:49 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-01-03 19:16:14 -0800 |
| commit | f72bec9e7a14477bcdf024db77c0a62811122392 (patch) | |
| tree | 09bac35fde7f634e9db6253b39a5f954370482af | |
| parent | fix(feeds): simple link and title (diff) | |
| download | due.moe-f72bec9e7a14477bcdf024db77c0a62811122392.tar.xz due.moe-f72bec9e7a14477bcdf024db77c0a62811122392.zip | |
fix(feeds): return early if null
| -rw-r--r-- | src/routes/feeds/activity-notifications/+server.ts | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/routes/feeds/activity-notifications/+server.ts b/src/routes/feeds/activity-notifications/+server.ts index 0cdc3bc1..a9698d72 100644 --- a/src/routes/feeds/activity-notifications/+server.ts +++ b/src/routes/feeds/activity-notifications/+server.ts @@ -33,12 +33,19 @@ const render = (posts: Notification[] = []) => `<?xml version="1.0" encoding="UT return text.charAt(0).toUpperCase() + text.substr(1).toLowerCase(); }); - link = `https://anilist.co/${notification.thread ? 'forum/thread' : 'activity'}/${ - notification.thread ? notification.thread.id : notification.activity.id - }`; - - if (notification.type.toString().includes('THREAD')) - title += `${notification.thread ? notification.thread.title : notification.activity.id}`; + try { + if ( + !['FOLLOWING', 'ACTIVITY_MESSAGE'].includes(notification.type.toString()) && + !notification.type.toString().includes('THREAD') + ) { + link = `https://anilist.co/activity/${notification.activity.id}`; + } else if (notification.type.toString().includes('THREAD')) { + title += `${notification.thread.title}`; + link = `https://anilist.co/forum/thread/${notification.thread.id}`; + } + } catch { + return ''; + } return `<item> <guid isPermaLink="false">${notification.id}</guid> |