MCPcopy Index your code
hub / github.com/Linen-dev/linen.dev / get

Method get

apps/web/services/feed/index.ts:57–95  ·  view source on GitHub ↗
({ lastReplyAt }: { lastReplyAt?: number })

Source from the content-addressed store, hash-verified

55
56export default class FeedService {
57 static async get({ lastReplyAt }: { lastReplyAt?: number }) {
58 let accounts: accountsType[] = [];
59 let ids: string[] = [];
60
61 const queryResult = await fetch({ lastReplyAt });
62
63 const threads = queryResult
64 .filter((thread) =>
65 thread.messages.every(
66 (m) =>
67 // we filter threads with messages from bots here instead of through query
68 !m.author?.isBot ||
69 // except linenBot messages from feed channel
70 (m.author.externalUserId === config.linen.bot.externalId &&
71 thread.channelId === config.linen.feedChannelId)
72 )
73 )
74 .map((thread) => {
75 const { account } = thread.channel;
76 if (account && !ids.includes(account.id)) {
77 ids.push(account.id);
78 accounts.push(account);
79 }
80 return serializeThread(thread);
81 });
82
83 let cursor;
84 try {
85 // using queryResult because it was not filtered on code
86 cursor = queryResult[queryResult.length - 1].lastReplyAt?.toString();
87 } catch (error) {}
88
89 return {
90 threads,
91 settings: accounts.map(serializeSettings),
92 communities: accounts.map(serializeAccount),
93 cursor,
94 };
95 }
96
97 static async mark() {
98 const threads = await prisma.threads.findMany({

Callers 15

middlewareFunction · 0.45
handlerFunction · 0.45
handlerFunction · 0.45
handlerFunction · 0.45
handlerFunction · 0.45
createFunction · 0.45
handlerFunction · 0.45
handlerFunction · 0.45
handlerFunction · 0.45
indexFunction · 0.45
handlerFunction · 0.45
handlerFunction · 0.45

Calls 2

serializeThreadFunction · 0.90
mapMethod · 0.80

Tested by 2

step3_signInFunction · 0.36
step4_routerFunction · 0.36