From 5e8c0deab3d62c2c2cfd1fda14dc63179f65257d Mon Sep 17 00:00:00 2001
From: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>
Date: Sat, 7 Oct 2023 13:13:13 +0900
Subject: プライバシーポリシー・運営者情報のリンクを追加 (#11925)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* 運営者情報・プライバシーポリシーリンクを追加

* Update Changelog

* Run api extractor

* プライバシーポリシー・利用規約の同意をまとめる

* Update Changelog

* fix lint

* fix

* api extractor

* improve design

* nodeinfoにプライバシーポリシー・運営者情報を追加
---
 .../src/components/MkSignupDialog.rules.vue        | 45 +++++++++++++++-------
 1 file changed, 31 insertions(+), 14 deletions(-)

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

diff --git a/packages/frontend/src/components/MkSignupDialog.rules.vue b/packages/frontend/src/components/MkSignupDialog.rules.vue
index aa4a184d7b..76163ab68b 100644
--- a/packages/frontend/src/components/MkSignupDialog.rules.vue
+++ b/packages/frontend/src/components/MkSignupDialog.rules.vue
@@ -30,13 +30,15 @@ SPDX-License-Identifier: AGPL-3.0-only
 				<MkSwitch :modelValue="agreeServerRules" style="margin-top: 16px;" @update:modelValue="updateAgreeServerRules">{{ i18n.ts.agree }}</MkSwitch>
 			</MkFolder>
 
-			<MkFolder v-if="availableTos" :defaultOpen="true">
-				<template #label>{{ i18n.ts.termsOfService }}</template>
-				<template #suffix><i v-if="agreeTos" class="ti ti-check" style="color: var(--success)"></i></template>
-
-				<a :href="instance.tosUrl" class="_link" target="_blank">{{ i18n.ts.termsOfService }} <i class="ti ti-external-link"></i></a>
-
-				<MkSwitch :modelValue="agreeTos" style="margin-top: 16px;" @update:modelValue="updateAgreeTos">{{ i18n.ts.agree }}</MkSwitch>
+			<MkFolder v-if="availableTos || availablePrivacyPolicy" :defaultOpen="true">
+				<template #label>{{ tosPrivacyPolicyLabel }}</template>
+				<template #suffix><i v-if="agreeTosAndPrivacyPolicy" class="ti ti-check" style="color: var(--success)"></i></template>
+				<div class="_gaps_s">
+					<div v-if="availableTos"><a :href="instance.tosUrl" class="_link" target="_blank">{{ i18n.ts.termsOfService }} <i class="ti ti-external-link"></i></a></div>
+					<div v-if="availablePrivacyPolicy"><a :href="instance.privacyPolicyUrl" class="_link" target="_blank">{{ i18n.ts.privacyPolicy }} <i class="ti ti-external-link"></i></a></div>
+				</div>
+
+				<MkSwitch :modelValue="agreeTosAndPrivacyPolicy" style="margin-top: 16px;" @update:modelValue="updateAgreeTosAndPrivacyPolicy">{{ i18n.ts.agree }}</MkSwitch>
 			</MkFolder>
 
 			<MkFolder :defaultOpen="true">
@@ -70,14 +72,15 @@ import MkInfo from '@/components/MkInfo.vue';
 import * as os from '@/os.js';
 
 const availableServerRules = instance.serverRules.length > 0;
-const availableTos = instance.tosUrl != null;
+const availableTos = instance.tosUrl != null && instance.tosUrl !== '';
+const availablePrivacyPolicy = instance.privacyPolicyUrl != null && instance.privacyPolicyUrl !== '';
 
 const agreeServerRules = ref(false);
-const agreeTos = ref(false);
+const agreeTosAndPrivacyPolicy = ref(false);
 const agreeNote = ref(false);
 
 const agreed = computed(() => {
-	return (!availableServerRules || agreeServerRules.value) && (!availableTos || agreeTos.value) && agreeNote.value;
+	return (!availableServerRules || agreeServerRules.value) && ((!availableTos && !availablePrivacyPolicy) || agreeTosAndPrivacyPolicy.value) && agreeNote.value;
 });
 
 const emit = defineEmits<{
@@ -85,6 +88,18 @@ const emit = defineEmits<{
 	(ev: 'done'): void;
 }>();
 
+const tosPrivacyPolicyLabel = computed(() => {
+	if (availableTos && availablePrivacyPolicy) {
+		return i18n.ts.tosAndPrivacyPolicy;
+	} else if (availableTos) {
+		return i18n.ts.termsOfService;
+	} else if (availablePrivacyPolicy) {
+		return i18n.ts.privacyPolicy;
+	} else {
+		return "";
+	}
+});
+
 async function updateAgreeServerRules(v: boolean) {
 	if (v) {
 		const confirm = await os.confirm({
@@ -99,17 +114,19 @@ async function updateAgreeServerRules(v: boolean) {
 	}
 }
 
-async function updateAgreeTos(v: boolean) {
+async function updateAgreeTosAndPrivacyPolicy(v: boolean) {
 	if (v) {
 		const confirm = await os.confirm({
 			type: 'question',
 			title: i18n.ts.doYouAgree,
-			text: i18n.t('iHaveReadXCarefullyAndAgree', { x: i18n.ts.termsOfService }),
+			text: i18n.t('iHaveReadXCarefullyAndAgree', {
+				x: tosPrivacyPolicyLabel.value,
+			}),
 		});
 		if (confirm.canceled) return;
-		agreeTos.value = true;
+		agreeTosAndPrivacyPolicy.value = true;
 	} else {
-		agreeTos.value = false;
+		agreeTosAndPrivacyPolicy.value = false;
 	}
 }
 
-- 
cgit v1.2.3-freya

