[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.

remove unused resolver

+5 -10
-1
services/appview/src/routes/feed/getAuthorFeed.ts
··· 141 141 const postView = await transformPostToPostView( 142 142 post, 143 143 ctx.db, 144 - ctx.resolver, 145 144 viewerDid, 146 145 ) 147 146
+3 -3
services/appview/src/routes/feed/getPostThread.ts
··· 33 33 } 34 34 35 35 // Convert the main post to a PostView 36 - const mainPostView = await transformPostToPostView(mainPost, ctx.db, ctx.resolver, userDid) 36 + const mainPostView = await transformPostToPostView(mainPost, ctx.db, userDid) 37 37 38 38 // Get parent posts if this is a reply 39 39 const parentPosts: SoSprkFeedDefs.PostView[] = [] ··· 50 50 break 51 51 } 52 52 53 - const parentPostView = await transformPostToPostView(parentPost, ctx.db, ctx.resolver, userDid) 53 + const parentPostView = await transformPostToPostView(parentPost, ctx.db, userDid) 54 54 parentPosts.unshift(parentPostView) // Add at the beginning so root is first 55 55 56 56 // If we reached the root, stop ··· 125 125 depth = 0, 126 126 ): Promise<SoSprkFeedDefs.ThreadViewPost> { 127 127 // Convert the post to a post view 128 - const postView = await transformPostToPostView(post, ctx.db, ctx.resolver, userDid) 128 + const postView = await transformPostToPostView(post, ctx.db, userDid) 129 129 130 130 // If we've reached the maximum depth, don't fetch replies 131 131 if (depth <= 0) {
+2 -4
services/appview/src/routes/feed/getPosts.ts
··· 3 3 import { OutputSchema as GetPostsView } from '../../lexicon/types/so/sprk/feed/getPosts.js' 4 4 import { AppContext } from '../../index.js' 5 5 import { transformPostToPostView } from '../../utils/post-transformer.js' 6 - import { BidirectionalResolver } from '../../id-resolver.js' 7 6 import { Database } from '../../db.js' 8 7 import type * as SoSprkFeedDefs from '../../lexicon/types/so/sprk/feed/defs.js' 9 8 ··· 11 10 async function getPosts( 12 11 uris: string | string[], 13 12 db: Database, 14 - resolver: BidirectionalResolver, 15 13 userDid?: string, 16 14 ): Promise<SoSprkFeedDefs.PostView[]> { 17 15 if (!uris) { ··· 28 26 29 27 // Transform each post to PostView format 30 28 const postViews = await Promise.all( 31 - dbPosts.map((post) => transformPostToPostView(post, db, resolver, userDid)), 29 + dbPosts.map((post) => transformPostToPostView(post, db, userDid)), 32 30 ) 33 31 34 32 return postViews ··· 45 43 return c.json({ posts: [] } as GetPostsView) 46 44 } 47 45 48 - const posts = await getPosts(uris, ctx.db, ctx.resolver, userDid) 46 + const posts = await getPosts(uris, ctx.db, userDid) 49 47 50 48 return c.json({ posts } as GetPostsView) 51 49 })
-2
services/appview/src/utils/post-transformer.ts
··· 4 4 import type * as SoSprkEmbedImages from '../lexicon/types/so/sprk/embed/images.js' 5 5 import type * as SoSprkEmbedVideo from '../lexicon/types/so/sprk/embed/video.js' 6 6 import { Database, PostDocument } from '../db.js' 7 - import { BidirectionalResolver } from '../id-resolver.js' 8 7 9 8 // Transform DB post to PostView format 10 9 export async function transformPostToPostView( 11 10 post: PostDocument, 12 11 db: Database, 13 - resolver: BidirectionalResolver, 14 12 userDid?: string, 15 13 ): Promise<SoSprkFeedDefs.PostView> { 16 14 // Get like count