diff --git a/src/remote/activitypub/renderer/note.ts b/src/remote/activitypub/renderer/note.ts index cbdff7d203..ca823941c0 100644 --- a/src/remote/activitypub/renderer/note.ts +++ b/src/remote/activitypub/renderer/note.ts @@ -158,7 +158,7 @@ export default async function renderNote(note: Note, dive = true): Promise cc, inReplyTo, attachment: files.map(renderDocument), - sensitive: files.some(file => file.isSensitive), + sensitive: note.cw != null || files.some(file => file.isSensitive), tag, ...asPoll }; diff --git a/src/server/api/endpoints/notes/local-timeline.ts b/src/server/api/endpoints/notes/local-timeline.ts index c688b9325e..4149c6f900 100644 --- a/src/server/api/endpoints/notes/local-timeline.ts +++ b/src/server/api/endpoints/notes/local-timeline.ts @@ -112,12 +112,8 @@ export default define(meta, async (ps, user) => { })); if (ps.excludeNsfw) { - // v11 TODO - /* - query['_files.isSensitive'] = { - $ne: true - }; - */ + query.andWhere('note.cw IS NULL'); + query.andWhere('0 = (SELECT COUNT(*) FROM drive_file df WHERE df.id = ANY(note."fileIds") AND df."isSensitive" = TRUE)'); } } //#endregion diff --git a/src/server/api/endpoints/users/notes.ts b/src/server/api/endpoints/users/notes.ts index c8be19ff16..4869bd09fd 100644 --- a/src/server/api/endpoints/users/notes.ts +++ b/src/server/api/endpoints/users/notes.ts @@ -150,10 +150,8 @@ export default define(meta, async (ps, me) => { })); if (ps.excludeNsfw) { - // v11 TODO - /*query['_files.isSensitive'] = { - $ne: true - };*/ + query.andWhere('note.cw IS NULL'); + query.andWhere('0 = (SELECT COUNT(*) FROM drive_file df WHERE df.id = ANY(note."fileIds") AND df."isSensitive" = TRUE)'); } }