From 476dfb0f351c9b879de90fe3d1aef826ab03b82b Mon Sep 17 00:00:00 2001
From: syuilo <Syuilotan@yahoo.co.jp>
Date: Sat, 5 Mar 2022 01:22:57 +0900
Subject: [PATCH] =?UTF-8?q?fix(client):=20register=5Fnote=5Fview=5Finterru?=
 =?UTF-8?q?ptor()=E3=81=8C=E5=8B=95=E3=81=8B=E3=81=AA=E3=81=84=E3=81=AE?=
 =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fix #8318
---
 CHANGELOG.md                            |  1 +
 packages/client/src/components/note.vue | 15 +++++++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0c1d49f2e..dfb09b606 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -30,6 +30,7 @@ You should also include the user name that made the change.
 - Client: リアクションピッカーの高さが低くなったまま戻らないことがあるのを修正 @syuilo
 - Client: ユーザー名オートコンプリートが正しく動作しない問題を修正 @syuilo
 - Client: タッチ操作だとウィジェットの編集がしにくいのを修正 @xianonn
+- Client: register_note_view_interruptor()が動かないのを修正 @syuilo
 
 ## 12.107.0 (2022/02/12)
 
diff --git a/packages/client/src/components/note.vue b/packages/client/src/components/note.vue
index 93286a28b..3cd7a819d 100644
--- a/packages/client/src/components/note.vue
+++ b/packages/client/src/components/note.vue
@@ -138,7 +138,18 @@ const props = defineProps<{
 
 const inChannel = inject('inChannel', null);
 
-const note = $ref(JSON.parse(JSON.stringify(props.note)));
+let note = $ref(JSON.parse(JSON.stringify(props.note)));
+
+// plugin
+if (noteViewInterruptors.length > 0) {
+	onMounted(async () => {
+		let result = JSON.parse(JSON.stringify(note));
+		for (const interruptor of noteViewInterruptors) {
+			result = await interruptor.handler(result);
+		}
+		note = result;
+	});
+}
 
 const isRenote = (
 	note.renote != null &&
@@ -152,7 +163,7 @@ const menuButton = ref<HTMLElement>();
 const renoteButton = ref<InstanceType<typeof XRenoteButton>>();
 const renoteTime = ref<HTMLElement>();
 const reactButton = ref<HTMLElement>();
-let appearNote = $ref(isRenote ? note.renote as misskey.entities.Note : note);
+let appearNote = $computed(() => isRenote ? note.renote as misskey.entities.Note : note);
 const isMyRenote = $i && ($i.id === note.userId);
 const showContent = ref(false);
 const collapsed = ref(appearNote.cw == null && appearNote.text != null && (