From ab6a84cd45a266e97feee6a268495db8c161ce88 Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Tue, 27 Aug 2019 03:24:35 +0900 Subject: 未実装のTLのRenoteクエリを実装 (#5343) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * users/notes includeMyRenotes * other renotes * fix target user in users/notes * users/notesからv10から未実装でありえないオプションを削除 * users/notesのincludeMyRenotesの説明を修正 * remove needless anonymous checks --- src/server/api/endpoints/users/notes.ts | 40 +++++++-------------------------- 1 file changed, 8 insertions(+), 32 deletions(-) (limited to 'src/server/api/endpoints/users/notes.ts') diff --git a/src/server/api/endpoints/users/notes.ts b/src/server/api/endpoints/users/notes.ts index ef564b3c34..c8be19ff16 100644 --- a/src/server/api/endpoints/users/notes.ts +++ b/src/server/api/endpoints/users/notes.ts @@ -74,23 +74,7 @@ export const meta = { validator: $.optional.bool, default: true, desc: { - 'ja-JP': '自分の行ったRenoteを含めるかどうか' - } - }, - - includeRenotedMyNotes: { - validator: $.optional.bool, - default: true, - desc: { - 'ja-JP': 'Renoteされた自分の投稿を含めるかどうか' - } - }, - - includeLocalRenotes: { - validator: $.optional.bool, - default: true, - desc: { - 'ja-JP': 'Renoteされたローカルの投稿を含めるかどうか' + 'ja-JP': 'Renoteを含めるかどうか' } }, @@ -177,23 +161,15 @@ export default define(meta, async (ps, me) => { query.andWhere('note.replyId IS NULL'); } - /* TODO if (ps.includeMyRenotes === false) { - query.$and.push({ - $or: [{ - userId: { $ne: user.id } - }, { - renoteId: null - }, { - text: { $ne: null } - }, { - fileIds: { $ne: [] } - }, { - poll: { $ne: null } - }] - }); + query.andWhere(new Brackets(qb => { + qb.orWhere('note.userId != :userId', { userId: user.id }); + qb.orWhere('note.renoteId IS NULL'); + qb.orWhere('note.text IS NOT NULL'); + qb.orWhere('note.fileIds != \'{}\''); + qb.orWhere('0 < (SELECT COUNT(*) FROM poll WHERE poll."noteId" = note.id)'); + })); } - */ //#endregion -- cgit v1.2.3-freya