From aa72db76c4ce5c90ea502aca0ca0cc5d5b18829b Mon Sep 17 00:00:00 2001
From: dakkar <dakkar@thenautilus.net>
Date: Fri, 16 Feb 2024 12:24:35 +0000
Subject: rework boost visibility #388

* only show allowed visibilities
* "local only" is a switch

notice that the backend will limit the visibility, too
---
 packages/frontend/src/components/SkNoteSub.vue | 47 +++++---------------------
 1 file changed, 8 insertions(+), 39 deletions(-)

(limited to 'packages/frontend/src/components/SkNoteSub.vue')

diff --git a/packages/frontend/src/components/SkNoteSub.vue b/packages/frontend/src/components/SkNoteSub.vue
index 1641f8a5a4..1486742f42 100644
--- a/packages/frontend/src/components/SkNoteSub.vue
+++ b/packages/frontend/src/components/SkNoteSub.vue
@@ -113,6 +113,7 @@ import { reactionPicker } from '@/scripts/reaction-picker.js';
 import { claimAchievement } from '@/scripts/achievements.js';
 import { getNoteMenu } from '@/scripts/get-note-menu.js';
 import { useNoteCapture } from '@/scripts/use-note-capture.js';
+import { boostMenuItems, type Visibility } from '@/scripts/boost-quote.js';
 
 const canRenote = computed(() => ['public', 'home'].includes(props.note.visibility) || props.note.userId === $i.id);
 const hideLine = computed(() => { return props.detail ? true : false; });
@@ -290,43 +291,11 @@ function boostVisibility() {
 	if (!defaultStore.state.showVisibilitySelectorOnBoost) {
 		renote(defaultStore.state.visibilityOnBoost);
 	} else {
-		os.popupMenu([
-			{
-				type: 'button',
-				icon: 'ph-globe-hemisphere-west ph-bold ph-lg',
-				text: i18n.ts._visibility['public'],
-				action: () => {
-					renote('public');
-				},
-			},
-			{
-				type: 'button',
-				icon: 'ph-house ph-bold ph-lg',
-				text: i18n.ts._visibility['home'],
-				action: () => {
-					renote('home');
-				},
-			},
-			{
-				type: 'button',
-				icon: 'ph-lock ph-bold ph-lg',
-				text: i18n.ts._visibility['followers'],
-				action: () => {
-					renote('followers');
-				},
-			},
-			{
-				type: 'button',
-				icon: 'ph-planet ph-bold ph-lg',
-				text: i18n.ts._timelines.local,
-				action: () => {
-					renote('local');
-				},
-			}], renoteButton.value);
+		os.popupMenu(boostMenuItems(appearNote, renote), renoteButton.value);
 	}
 }
 
-function renote(visibility: 'public' | 'home' | 'followers' | 'specified' | 'local') {
+function renote(visibility: Visibility, localOnly: boolean = false) {
 	pleaseLogin();
 	showMovedDialog();
 
@@ -340,8 +309,8 @@ function renote(visibility: 'public' | 'home' | 'followers' | 'specified' | 'loc
 		}
 
 		misskeyApi('notes/create', {
-			renoteId: props.note.id,
-			channelId: props.note.channelId,
+			renoteId: appearNote.value.id,
+			channelId: appearNote.value.channelId,
 		}).then(() => {
 			os.toast(i18n.ts.renoted);
 			renoted.value = true;
@@ -356,9 +325,9 @@ function renote(visibility: 'public' | 'home' | 'followers' | 'specified' | 'loc
 		}
 
 		misskeyApi('notes/create', {
-			renoteId: props.note.id,
-			localOnly: visibility === 'local' ? true : false,
-			visibility: visibility === 'local' || visibility === 'specified' ? props.note.visibility : visibility,
+			renoteId: appearNote.value.id,
+			localOnly: localOnly,
+			visibility: visibility,
 		}).then(() => {
 			os.toast(i18n.ts.renoted);
 			renoted.value = true;
-- 
cgit v1.2.3-freya


From b0bc69aac8033e4022394358aeaac632a77054ef Mon Sep 17 00:00:00 2001
From: Marie <marie@kaifa.ch>
Date: Thu, 22 Feb 2024 21:16:08 +0000
Subject: Reactions not working on child notes in detailed view

---
 packages/frontend/src/components/MkNoteSub.vue | 4 ++--
 packages/frontend/src/components/SkNoteSub.vue | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

(limited to 'packages/frontend/src/components/SkNoteSub.vue')

diff --git a/packages/frontend/src/components/MkNoteSub.vue b/packages/frontend/src/components/MkNoteSub.vue
index ea108ad51c..37811dd52e 100644
--- a/packages/frontend/src/components/MkNoteSub.vue
+++ b/packages/frontend/src/components/MkNoteSub.vue
@@ -141,7 +141,7 @@ const replies = ref<Misskey.entities.Note[]>([]);
 const isRenote = (
 	props.note.renote != null &&
 	props.note.text == null &&
-	props.note.fileIds.length === 0 &&
+	props.note.fileIds && props.note.fileIds.length === 0 &&
 	props.note.poll == null
 );
 
@@ -211,7 +211,7 @@ function react(viaKeyboard = false): void {
 		}
 	} else {
 		blur();
-		reactionPicker.show(reactButton.value, reaction => {
+		reactionPicker.show(reactButton.value ?? null, props.note, reaction => {
 			misskeyApi('notes/reactions/create', {
 				noteId: props.note.id,
 				reaction: reaction,
diff --git a/packages/frontend/src/components/SkNoteSub.vue b/packages/frontend/src/components/SkNoteSub.vue
index 1486742f42..1cffd8dd66 100644
--- a/packages/frontend/src/components/SkNoteSub.vue
+++ b/packages/frontend/src/components/SkNoteSub.vue
@@ -155,7 +155,7 @@ const replies = ref<Misskey.entities.Note[]>([]);
 const isRenote = (
 	props.note.renote != null &&
 	props.note.text == null &&
-	props.note.fileIds.length === 0 &&
+	props.note.fileIds && props.note.fileIds.length === 0 &&
 	props.note.poll == null
 );
 
@@ -225,7 +225,7 @@ function react(viaKeyboard = false): void {
 		}
 	} else {
 		blur();
-		reactionPicker.show(reactButton.value, reaction => {
+		reactionPicker.show(reactButton.value ?? null, props.note, reaction => {
 			misskeyApi('notes/reactions/create', {
 				noteId: props.note.id,
 				reaction: reaction,
-- 
cgit v1.2.3-freya

