feat : update

This commit is contained in:
2026-10-08 14:51:44 +07:00 Unverified
parent 34c73e2f03
commit 721e2e5cf8
5 changed files with 78 additions and 41 deletions
+3 -3
View File
@@ -47,7 +47,7 @@ export async function getCommentTarget(target: string, viewer: CommentViewer | n
const [schedule] = await db.select({ id: stygianSchedules.scheduleId, name: stygianSchedules.challengeName })
.from(stygianSchedules).where(eq(stygianSchedules.scheduleId, parsed.id)).limit(1);
if (!schedule) throw new HttpError(404, "schedule-not-found");
return { target: `stygian:${schedule.id}`, name: `Stygian ${schedule.name}`, href: `/stygian/comment?schedule=${schedule.id}`, guideId: null, scheduleId: schedule.id, writable: true };
return { target: `stygian:${schedule.id}`, name: `Stygian (${schedule.name})`, href: `/stygian/comment?schedule=${schedule.id}`, guideId: null, scheduleId: schedule.id, writable: true };
}
export async function findCommentThread(target: string, viewer: CommentViewer | null) {
@@ -173,7 +173,7 @@ export async function listComments(options: {
canModerate: Boolean(viewer?.admin) && !row.guideTrashedAt,
canInteract: !c.deletedAt && !hidden && !row.guideTrashedAt && (row.publicTarget || Boolean(viewer?.admin)),
target: row.guideId ? `guide:${row.guideId}` : `stygian:${row.scheduleId}`,
targetName: row.guideName ?? `Stygian ${row.scheduleName}`,
targetName: row.guideName ?? `Stygian (${row.scheduleName})`,
href: `${row.guideSlug ? `/${row.guideSlug}/comment` : `/stygian/comment?schedule=${row.scheduleId}`}#comment-${c.rootId ?? c.id}`,
};
});
@@ -293,5 +293,5 @@ export async function listCommentTargets() {
getDb().select({ id: guides.id, name: guides.name, characterKey: guides.characterKey, imageKey: catalogCharacters.imageKey, rarity: catalogCharacters.rarity }).from(guides).leftJoin(catalogCharacters, eq(catalogCharacters.key, guides.characterKey)).orderBy(asc(guides.name)),
getDb().select({ id: stygianSchedules.scheduleId, name: stygianSchedules.challengeName }).from(stygianSchedules).orderBy(desc(stygianSchedules.scheduleId)),
]);
return [...characters.map((g) => ({ value: `guide:${g.id}`, label: g.name, image: g.imageKey ? publicMediaUrl(g.imageKey) : null, rarity: g.rarity, characterKey: g.characterKey })), ...schedules.map((s) => ({ value: `stygian:${s.id}`, label: `Stygian ${s.name}`, image: null, rarity: null, characterKey: null }))];
return [...characters.map((g) => ({ value: `guide:${g.id}`, label: g.name, image: g.imageKey ? publicMediaUrl(g.imageKey) : null, rarity: g.rarity, characterKey: g.characterKey })), ...schedules.map((s) => ({ value: `stygian:${s.id}`, label: `Stygian (${s.name})`, image: null, rarity: null, characterKey: null }))];
}