From 0e0c61e64ae23f9459301360b4b4e12cf685bc04 Mon Sep 17 00:00:00 2001
From: syuilo <Syuilotan@yahoo.co.jp>
Date: Thu, 28 Sep 2023 11:02:01 +0900
Subject: [PATCH] =?UTF-8?q?enhance:=20=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC?=
 =?UTF-8?q?=E3=83=9A=E3=83=BC=E3=82=B8=E3=81=AE=E3=83=8E=E3=83=BC=E3=83=88?=
 =?UTF-8?q?=E4=B8=80=E8=A6=A7=E3=81=A7Renote=E3=82=92=E9=99=A4=E5=A4=96?=
 =?UTF-8?q?=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 CHANGELOG.md                                          |  1 +
 .../backend/src/server/api/endpoints/users/notes.ts   | 11 +++++++++++
 packages/frontend/src/pages/user/index.timeline.vue   |  9 +++++----
 3 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index b9b03bc266..3e943714cc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,7 @@
 ## next
 
 ### General
+- Enhance: ユーザーページのノート一覧でRenoteを除外できるように
 
 ### Client
 - Enhance: モデレーションログ機能の強化
diff --git a/packages/backend/src/server/api/endpoints/users/notes.ts b/packages/backend/src/server/api/endpoints/users/notes.ts
index 5934baef47..982fcc858a 100644
--- a/packages/backend/src/server/api/endpoints/users/notes.ts
+++ b/packages/backend/src/server/api/endpoints/users/notes.ts
@@ -42,6 +42,7 @@ export const paramDef = {
 	properties: {
 		userId: { type: 'string', format: 'misskey:id' },
 		includeReplies: { type: 'boolean', default: true },
+		includeRenotes: { type: 'boolean', default: true },
 		limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
 		sinceId: { type: 'string', format: 'misskey:id' },
 		untilId: { type: 'string', format: 'misskey:id' },
@@ -118,6 +119,16 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
 				query.andWhere('note.replyId IS NULL');
 			}
 
+			if (ps.includeRenotes === false) {
+				query.andWhere(new Brackets(qb => {
+					qb.orWhere('note.renoteId IS NULL');
+					qb.orWhere(new Brackets(qb => {
+						qb.orWhere('note.text IS NOT NULL');
+						qb.orWhere('note.fileIds != \'{}\'');
+					}));
+				}));
+			}
+
 			if (ps.includeMyRenotes === false) {
 				query.andWhere(new Brackets(qb => {
 					qb.orWhere('note.userId != :userId', { userId: user.id });
diff --git a/packages/frontend/src/pages/user/index.timeline.vue b/packages/frontend/src/pages/user/index.timeline.vue
index 3a2a2ade81..fcb2b41651 100644
--- a/packages/frontend/src/pages/user/index.timeline.vue
+++ b/packages/frontend/src/pages/user/index.timeline.vue
@@ -9,7 +9,7 @@ SPDX-License-Identifier: AGPL-3.0-only
 		<template #header>
 			<MkTab v-model="include" :class="$style.tab">
 				<option :value="null">{{ i18n.ts.notes }}</option>
-				<option value="replies">{{ i18n.ts.notesAndReplies }}</option>
+				<option value="all">{{ i18n.ts.all }}</option>
 				<option value="files">{{ i18n.ts.withFiles }}</option>
 			</MkTab>
 		</template>
@@ -36,7 +36,8 @@ const pagination = {
 	limit: 10,
 	params: computed(() => ({
 		userId: props.user.id,
-		includeReplies: include.value === 'replies' || include.value === 'files',
+		includeRenotes: include.value === 'all',
+		includeReplies: include.value === 'all' || include.value === 'files',
 		withFiles: include.value === 'files',
 	})),
 };
@@ -51,7 +52,7 @@ const pagination = {
 
 .tl {
 	background: var(--bg);
-    border-radius: var(--radius);
-    overflow: clip;
+	border-radius: var(--radius);
+	overflow: clip;
 }
 </style>