From 9d288c06133485bb9246c3d0f65812ba8fb2f995 Mon Sep 17 00:00:00 2001 From: Johann150 Date: Fri, 18 Oct 2024 17:26:13 +0200 Subject: [PATCH] translate comments --- .../backend/src/remote/activitypub/models/note.ts | 11 ++++++++--- .../backend/src/remote/activitypub/models/person.ts | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/backend/src/remote/activitypub/models/note.ts b/packages/backend/src/remote/activitypub/models/note.ts index 96d188e55..be4f44f69 100644 --- a/packages/backend/src/remote/activitypub/models/note.ts +++ b/packages/backend/src/remote/activitypub/models/note.ts @@ -319,9 +319,14 @@ export async function resolveNote(value: string | IObject, resolver: Resolver): throw new StatusError('cannot resolve local note', 400, 'cannot resolve local note'); } - // リモートサーバーからフェッチしてきて登録 - // ここでuriの代わりに添付されてきたNote Objectが指定されていると、サーバーフェッチを経ずにノートが生成されるが - // 添付されてきたNote Objectは偽装されている可能性があるため、常にuriを指定してサーバーフェッチを行う。 + /* + If the Note Object attached is specified here instead of uri + after fetching from a remote server and registering, the note is + generated without going through server fetch, but the attached + Note Object may be spoofed, so always specify uri for server + Therefore, server fetching is always performed by specifying uri. + */ + return await createNote(uri, resolver, true); } finally { unlock(); diff --git a/packages/backend/src/remote/activitypub/models/person.ts b/packages/backend/src/remote/activitypub/models/person.ts index ba688aa25..5a4c1d8ed 100644 --- a/packages/backend/src/remote/activitypub/models/person.ts +++ b/packages/backend/src/remote/activitypub/models/person.ts @@ -459,7 +459,7 @@ async function updateFeatured(userId: User['id'], resolver: Resolver) { const unresolvedItems = isCollection(collection) ? collection.items : collection.orderedItems; const items = await Promise.all(toArray(unresolvedItems).map(x => resolver.resolve(x))); - // Resolve and regist Notes + // Resolve and register Notes const limit = promiseLimit(2); const featuredNotes = await Promise.all(items .filter(item => getApType(item) === 'Note') // TODO: Noteでなくてもいいかも @@ -469,7 +469,7 @@ async function updateFeatured(userId: User['id'], resolver: Resolver) { await db.transaction(async transactionalEntityManager => { await transactionalEntityManager.delete(UserNotePining, { userId: user.id }); - // とりあえずidを別の時間で生成して順番を維持 + // TODO: For now, generate the id at a different time and maintain the order. let td = 0; for (const note of featuredNotes.filter(note => note != null)) { td -= 1000;