MCPcopy Index your code
hub / github.com/AnswerOverflow/AnswerOverflow / findManyMessagesWithAuthors

Function findManyMessagesWithAuthors

packages/core/src/message.ts:362–413  ·  view source on GitHub ↗
(
	ids: string[],
	opts?: {
		excludePrivateMessages?: boolean;
	},
)

Source from the content-addressed store, hash-verified

360
361// TODO: We want USS to only be for the server the message is in, not all servers the user is in, is that possible?
362export async function findManyMessagesWithAuthors(
363 ids: string[],
364 opts?: {
365 excludePrivateMessages?: boolean;
366 },
367): Promise<MessageFull[]> {
368 if (ids.length === 0) return [];
369 const msgs = await dbReplica.query.dbMessages
370 .findMany({
371 where: inArray(dbMessages.id, ids),
372 with: {
373 author: {
374 with: {
375 userServerSettings: true,
376 },
377 },
378 attachments: true,
379 solutions: {
380 with: {
381 author: {
382 with: {
383 userServerSettings: true,
384 },
385 },
386 attachments: true,
387 },
388 },
389 reference: {
390 with: {
391 author: {
392 with: {
393 userServerSettings: true,
394 },
395 },
396 attachments: true,
397 },
398 },
399 server: true,
400 },
401 })
402 .then((x) => applyPublicFlagsToMessages(x));
403 const msgLookup = new Map(msgs.map((msg) => [msg.id, msg]));
404 return ids
405 .map((id) => msgLookup.get(id))
406 .filter((x) => {
407 if (!x) return false;
408 if (opts?.excludePrivateMessages) {
409 return x.public;
410 }
411 return true;
412 }) as MessageFull[];
413}
414// TODO: Paginate get all questions response
415export async function findAllChannelQuestions(input: {
416 channelId: string;

Callers 7

message.test.tsFile · 0.90
listPublicThreadsFunction · 0.90
searchMessagesFunction · 0.90
getUserPageDataFunction · 0.90
getUserPageDataFunction · 0.90
findAllChannelQuestionsFunction · 0.85

Calls 1

Tested by

no test coverage detected