[READ ONLY MIRROR] Spark Social AppView Server github.com/sprksocial/server
atproto deno hono lexicon
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

include owner stories (#42)

authored by

Davi Rodrigues and committed by
GitHub
dd4c0135 fe18333d

+7 -3
+7 -3
api/so/sprk/feed/getStories.ts
··· 103 103 return sortedStories; 104 104 } 105 105 106 - // Check if stories are expired (24 hours old) 107 - function filterExpiredStories(stories: StoryDocument[]): StoryDocument[] { 106 + function filterExpiredStories( 107 + stories: StoryDocument[], 108 + ownerDid?: string, 109 + ): StoryDocument[] { 108 110 const twentyFourHoursAgo = new Date(); 109 111 twentyFourHoursAgo.setHours(twentyFourHoursAgo.getHours() - 24); 110 112 111 113 return stories.filter((story) => { 114 + // If the authenticated user is the author, not apply the 24h expiration filter 115 + if (ownerDid && story.authorDid === ownerDid) return true; 112 116 const storyDate = new Date(story.indexedAt); 113 117 return storyDate >= twentyFourHoursAgo; 114 118 }); ··· 189 193 } 190 194 191 195 // Filter out expired stories (older than 24 hours) 192 - const activeStories = filterExpiredStories(dbStories); 196 + const activeStories = filterExpiredStories(dbStories, userDid); 193 197 194 198 if (activeStories.length === 0) { 195 199 return {