Fixed 267U.pre2

This commit is contained in:
2026-07-26 18:25:37 +09:00
parent 50bfaeafdf
commit 317d00a284
1286 changed files with 80222 additions and 1 deletions
@@ -0,0 +1,17 @@
import promiseLimit from "promise-limit";
import { toArray, unique } from "../../../prelude/array.js";
import { isMention } from "../type.js";
import Resolver from "../resolver.js";
import { resolvePerson } from "./person.js";
import { RecursionLimiter } from "../../../models/repositories/user-profile.js";
export async function extractApMentions(tags, limiter = new RecursionLimiter()) {
const hrefs = unique(extractApMentionObjects(tags).map((x)=>x.href));
const resolver = new Resolver();
const limit = promiseLimit(2);
const mentionedUsers = (await Promise.all(hrefs.map((x)=>limit(()=>resolvePerson(x, resolver, limiter).catch(()=>null))))).filter((x)=>x != null);
return mentionedUsers;
}
export function extractApMentionObjects(tags) {
if (tags == null) return [];
return toArray(tags).filter(isMention);
}