server: properly parse pinned post types

This commit is contained in:
Johann150 2024-10-18 17:28:38 +02:00
parent 9d288c0613
commit 4aae4a5ffb
Signed by: Johann150
GPG key ID: 9EE6577A2A06F8F1

View file

@ -27,7 +27,7 @@ import { db } from '@/db/postgre.js';
import { fromHtml } from '@/mfm/from-html.js';
import { Resolver } from '@/remote/activitypub/resolver.js';
import { apLogger } from '../logger.js';
import { isCollectionOrOrderedCollection, isCollection, IActor, getApId, getOneApHrefNullable, IObject, isPropertyValue, getApType, isActor } from '../type.js';
import { isCollectionOrOrderedCollection, isCollection, IActor, getApId, getOneApHrefNullable, IObject, isPropertyValue, getApType, isActor, isPost } from '../type.js';
import { extractApHashtags, extractEmojis } from './tag.js';
import { resolveNote } from './note.js';
import { resolveImage } from './image.js';
@ -462,7 +462,7 @@ async function updateFeatured(userId: User['id'], resolver: Resolver) {
// Resolve and register Notes
const limit = promiseLimit<Note | null>(2);
const featuredNotes = await Promise.all(items
.filter(item => getApType(item) === 'Note') // TODO: Noteでなくてもいいかも
.filter(item => isPost(item))
.slice(0, 5)
.map(item => limit(() => resolveNote(item, resolver))));