From e9376cc65cbd4deb2b5275e5431ab50702164bb0 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 9 Jul 2023 08:56:27 +0200 Subject: [PATCH] Add `includeRenotes` and `renotesOnly` options to `/api/users/notes` --- .../backend/src/server/api/endpoints/users/notes.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/backend/src/server/api/endpoints/users/notes.ts b/packages/backend/src/server/api/endpoints/users/notes.ts index 724cfc9af1..142fccf96a 100644 --- a/packages/backend/src/server/api/endpoints/users/notes.ts +++ b/packages/backend/src/server/api/endpoints/users/notes.ts @@ -45,6 +45,8 @@ export const paramDef = { untilId: { type: "string", format: "misskey:id" }, sinceDate: { type: "integer" }, untilDate: { type: "integer" }, + includeRenotes: { type: "boolean", default: true }, + renotesOnly: { type: "boolean", default: false }, includeMyRenotes: { type: "boolean", default: true }, withFiles: { type: "boolean", default: false }, fileType: { @@ -122,6 +124,14 @@ export default define(meta, paramDef, async (ps, me) => { query.andWhere("note.replyId IS NULL"); } + if (!ps.includeRenotes) { + query.andWhere("note.renoteId IS NULL"); + } + + if (ps.renotesOnly) { + query.andWhere("note.renoteId IS NOT NULL"); + } + if (ps.includeMyRenotes === false) { query.andWhere( new Brackets((qb) => {