From 1a689f66419d2ea2f4eb34fa3fe868ea250fdbb9 Mon Sep 17 00:00:00 2001
From: MeiMei <30769358+mei23@users.noreply.github.com>
Date: Fri, 12 Oct 2018 05:10:40 +0900
Subject: [PATCH] =?UTF-8?q?=E5=89=8A=E9=99=A4=E3=81=95=E3=82=8C=E3=81=9F?=
 =?UTF-8?q?=E6=8A=95=E7=A8=BF=E3=81=AF=E3=82=BF=E3=82=A4=E3=83=A0=E3=83=A9?=
 =?UTF-8?q?=E3=82=A4=E3=83=B3=E4=B8=8A=E3=81=A7=E8=A1=A8=E7=A4=BA=E3=81=97?=
 =?UTF-8?q?=E3=81=AA=E3=81=84=E3=82=88=E3=81=86=E3=81=AB=E3=81=99=E3=82=8B?=
 =?UTF-8?q?=20(#2887)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* Excepts deleted notes on query

* Hide deleted notes

* Use v-show
---
 src/client/app/desktop/views/components/notes.note.vue | 2 +-
 src/client/app/desktop/views/pages/deck/deck.note.vue  | 2 +-
 src/client/app/mobile/views/components/note.vue        | 2 +-
 src/server/api/endpoints/notes/global-timeline.ts      | 2 ++
 src/server/api/endpoints/notes/hybrid-timeline.ts      | 2 ++
 src/server/api/endpoints/notes/local-timeline.ts       | 2 ++
 src/server/api/endpoints/notes/mentions.ts             | 2 ++
 src/server/api/endpoints/notes/timeline.ts             | 2 ++
 src/server/api/endpoints/notes/user-list-timeline.ts   | 2 ++
 src/server/api/endpoints/users/notes.ts                | 1 +
 10 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/client/app/desktop/views/components/notes.note.vue b/src/client/app/desktop/views/components/notes.note.vue
index 2db1479823..3d8a6815ba 100644
--- a/src/client/app/desktop/views/components/notes.note.vue
+++ b/src/client/app/desktop/views/components/notes.note.vue
@@ -1,5 +1,5 @@
 <template>
-<div class="note" tabindex="-1" v-hotkey="keymap" :title="title">
+<div class="note" v-show="p.deletedAt == null" tabindex="-1" v-hotkey="keymap" :title="title">
 	<div class="reply-to" v-if="p.reply && (!$store.getters.isSignedIn || $store.state.settings.showReplyTarget)">
 		<x-sub :note="p.reply"/>
 	</div>
diff --git a/src/client/app/desktop/views/pages/deck/deck.note.vue b/src/client/app/desktop/views/pages/deck/deck.note.vue
index e843ac54fe..c83a438a60 100644
--- a/src/client/app/desktop/views/pages/deck/deck.note.vue
+++ b/src/client/app/desktop/views/pages/deck/deck.note.vue
@@ -1,5 +1,5 @@
 <template>
-<div v-if="!mediaView" class="zyjjkidcqjnlegkqebitfviomuqmseqk" :class="{ renote: isRenote }">
+<div v-if="!mediaView" v-show="p.deletedAt == null" class="zyjjkidcqjnlegkqebitfviomuqmseqk" :class="{ renote: isRenote }">
 	<div class="reply-to" v-if="p.reply && (!$store.getters.isSignedIn || $store.state.settings.showReplyTarget)">
 		<x-sub :note="p.reply"/>
 	</div>
diff --git a/src/client/app/mobile/views/components/note.vue b/src/client/app/mobile/views/components/note.vue
index f370fbf874..d5770f1531 100644
--- a/src/client/app/mobile/views/components/note.vue
+++ b/src/client/app/mobile/views/components/note.vue
@@ -1,5 +1,5 @@
 <template>
-<div class="note" :class="{ renote: isRenote, smart: $store.state.device.postStyle == 'smart' }">
+<div class="note" v-show="p.deletedAt == null" :class="{ renote: isRenote, smart: $store.state.device.postStyle == 'smart' }">
 	<div class="reply-to" v-if="p.reply && (!$store.getters.isSignedIn || $store.state.settings.showReplyTarget)">
 		<x-sub :note="p.reply"/>
 	</div>
diff --git a/src/server/api/endpoints/notes/global-timeline.ts b/src/server/api/endpoints/notes/global-timeline.ts
index 8362143bb2..8a6c848943 100644
--- a/src/server/api/endpoints/notes/global-timeline.ts
+++ b/src/server/api/endpoints/notes/global-timeline.ts
@@ -58,6 +58,8 @@ export default async (params: any, user: ILocalUser) => {
 	};
 
 	const query = {
+		deletedAt: null,
+
 		// public only
 		visibility: 'public',
 
diff --git a/src/server/api/endpoints/notes/hybrid-timeline.ts b/src/server/api/endpoints/notes/hybrid-timeline.ts
index 14b4432b33..b2ea9c60ac 100644
--- a/src/server/api/endpoints/notes/hybrid-timeline.ts
+++ b/src/server/api/endpoints/notes/hybrid-timeline.ts
@@ -129,6 +129,8 @@ export default async (params: any, user: ILocalUser) => {
 
 	const query = {
 		$and: [{
+			deletedAt: null,
+
 			$or: [{
 				// フォローしている人の投稿
 				$or: followQuery
diff --git a/src/server/api/endpoints/notes/local-timeline.ts b/src/server/api/endpoints/notes/local-timeline.ts
index 8ab07d8ea7..510564129c 100644
--- a/src/server/api/endpoints/notes/local-timeline.ts
+++ b/src/server/api/endpoints/notes/local-timeline.ts
@@ -71,6 +71,8 @@ export default async (params: any, user: ILocalUser) => {
 	};
 
 	const query = {
+		deletedAt: null,
+
 		// public only
 		visibility: 'public',
 
diff --git a/src/server/api/endpoints/notes/mentions.ts b/src/server/api/endpoints/notes/mentions.ts
index 592a94263d..27b6245eb6 100644
--- a/src/server/api/endpoints/notes/mentions.ts
+++ b/src/server/api/endpoints/notes/mentions.ts
@@ -45,6 +45,8 @@ export default (params: any, user: ILocalUser) => new Promise(async (res, rej) =
 
 	// Construct query
 	const query = {
+		deletedAt: null,
+
 		$or: [{
 			mentions: user._id
 		}, {
diff --git a/src/server/api/endpoints/notes/timeline.ts b/src/server/api/endpoints/notes/timeline.ts
index 44a504eb18..31a4978407 100644
--- a/src/server/api/endpoints/notes/timeline.ts
+++ b/src/server/api/endpoints/notes/timeline.ts
@@ -132,6 +132,8 @@ export default async (params: any, user: ILocalUser) => {
 
 	const query = {
 		$and: [{
+			deletedAt: null,
+
 			// フォローしている人の投稿
 			$or: followQuery,
 
diff --git a/src/server/api/endpoints/notes/user-list-timeline.ts b/src/server/api/endpoints/notes/user-list-timeline.ts
index 6758b4eb73..7dddc4834e 100644
--- a/src/server/api/endpoints/notes/user-list-timeline.ts
+++ b/src/server/api/endpoints/notes/user-list-timeline.ts
@@ -137,6 +137,8 @@ export default async (params: any, user: ILocalUser) => {
 
 	const query = {
 		$and: [{
+			deletedAt: null,
+
 			// リストに入っている人のタイムラインへの投稿
 			$or: listQuery,
 
diff --git a/src/server/api/endpoints/users/notes.ts b/src/server/api/endpoints/users/notes.ts
index 1bfe832c51..002ddf23e5 100644
--- a/src/server/api/endpoints/users/notes.ts
+++ b/src/server/api/endpoints/users/notes.ts
@@ -136,6 +136,7 @@ export default (params: any, me: ILocalUser) => new Promise(async (res, rej) =>
 	};
 
 	const query = {
+		deletedAt: null,
 		userId: user._id
 	} as any;