diff --git a/src/remote/activitypub/models/note.ts b/src/remote/activitypub/models/note.ts index dbad63ea4..02bce6fec 100644 --- a/src/remote/activitypub/models/note.ts +++ b/src/remote/activitypub/models/note.ts @@ -81,7 +81,9 @@ export async function createNote(value: any, resolver?: Resolver, silent = false // 添付メディア // TODO: attachmentは必ずしもImageではない // TODO: attachmentは必ずしも配列ではない + // Noteがsensitiveなら添付もsensitiveにする const media = note.attachment + .map(attach => attach.sensitive = note.sensitive) ? await Promise.all(note.attachment.map(x => resolveImage(actor, x))) : []; diff --git a/src/remote/activitypub/renderer/note.ts b/src/remote/activitypub/renderer/note.ts index 209e74392..1d169d308 100644 --- a/src/remote/activitypub/renderer/note.ts +++ b/src/remote/activitypub/renderer/note.ts @@ -79,6 +79,8 @@ export default async function renderNote(note: INote, dive = true): Promise ...mentionTags, ]; + const files = await promisedFiles; + return { id: `${config.url}/notes/${note._id}`, type: 'Note', @@ -89,7 +91,8 @@ export default async function renderNote(note: INote, dive = true): Promise to, cc, inReplyTo, - attachment: (await promisedFiles).map(renderDocument), + attachment: files.map(renderDocument), + sensitive: files.some(file => file.metadata.isSensitive), tag }; } diff --git a/src/remote/activitypub/type.ts b/src/remote/activitypub/type.ts index 9761b66dc..3d40ad48c 100644 --- a/src/remote/activitypub/type.ts +++ b/src/remote/activitypub/type.ts @@ -16,6 +16,7 @@ export interface IObject { image?: any; url?: string; tag?: any[]; + sensitive?: boolean; } export interface IActivity extends IObject {