From 25580e8afc2afa8bd5dca3b0a15aea5527792ef8 Mon Sep 17 00:00:00 2001
From: syuilo <Syuilotan@yahoo.co.jp>
Date: Mon, 1 May 2023 17:09:07 +0900
Subject: [PATCH] :art:

---
 .../frontend/src/pages/admin/moderation.vue   | 47 ++++++++++++-------
 .../frontend/src/pages/admin/settings.vue     | 14 ------
 2 files changed, 30 insertions(+), 31 deletions(-)

diff --git a/packages/frontend/src/pages/admin/moderation.vue b/packages/frontend/src/pages/admin/moderation.vue
index 1ee07d383e..ffd3b6e233 100644
--- a/packages/frontend/src/pages/admin/moderation.vue
+++ b/packages/frontend/src/pages/admin/moderation.vue
@@ -3,25 +3,32 @@
 	<MkStickyContainer>
 		<template #header><XHeader :tabs="headerTabs"/></template>
 		<MkSpacer :content-max="700" :margin-min="16" :margin-max="32">
-			<FormLink to="/admin/server-rules">{{ i18n.ts.serverRules }}</FormLink>
 			<FormSuspense :p="init">
 				<div class="_gaps_m">
-					<FormSection first>
-						<div class="_gaps_m">
-							<MkInput v-model="tosUrl">
-								<template #prefix><i class="ti ti-link"></i></template>
-								<template #label>{{ i18n.ts.tosUrl }}</template>
-							</MkInput>
-							<MkTextarea v-model="preservedUsernames">
-								<template #label>{{ i18n.ts.preservedUsernames }}</template>
-								<template #caption>{{ i18n.ts.preservedUsernamesDescription }}</template>
-							</MkTextarea>
-							<MkTextarea v-model="sensitiveWords">
-								<template #label>{{ i18n.ts.sensitiveWords }}</template>
-								<template #caption>{{ i18n.ts.sensitiveWordsDescription }}</template>
-							</MkTextarea>
-						</div>
-					</FormSection>
+					<MkSwitch v-model="enableRegistration">
+						<template #label>{{ i18n.ts.enableRegistration }}</template>
+					</MkSwitch>
+
+					<MkSwitch v-model="emailRequiredForSignup">
+						<template #label>{{ i18n.ts.emailRequiredForSignup }}</template>
+					</MkSwitch>
+
+					<FormLink to="/admin/server-rules">{{ i18n.ts.serverRules }}</FormLink>
+
+					<MkInput v-model="tosUrl">
+						<template #prefix><i class="ti ti-link"></i></template>
+						<template #label>{{ i18n.ts.tosUrl }}</template>
+					</MkInput>
+
+					<MkTextarea v-model="preservedUsernames">
+						<template #label>{{ i18n.ts.preservedUsernames }}</template>
+						<template #caption>{{ i18n.ts.preservedUsernamesDescription }}</template>
+					</MkTextarea>
+					
+					<MkTextarea v-model="sensitiveWords">
+						<template #label>{{ i18n.ts.sensitiveWords }}</template>
+						<template #caption>{{ i18n.ts.sensitiveWordsDescription }}</template>
+					</MkTextarea>
 				</div>
 			</FormSuspense>
 		</MkSpacer>
@@ -52,12 +59,16 @@ import { definePageMetadata } from '@/scripts/page-metadata';
 import MkButton from '@/components/MkButton.vue';
 import FormLink from '@/components/form/link.vue';
 
+let enableRegistration: boolean = $ref(false);
+let emailRequiredForSignup: boolean = $ref(false);
 let sensitiveWords: string = $ref('');
 let preservedUsernames: string = $ref('');
 let tosUrl: string | null = $ref(null);
 
 async function init() {
 	const meta = await os.api('admin/meta');
+	enableRegistration = !meta.disableRegistration;
+	emailRequiredForSignup = meta.emailRequiredForSignup;
 	sensitiveWords = meta.sensitiveWords.join('\n');
 	preservedUsernames = meta.preservedUsernames.join('\n');
 	tosUrl = meta.tosUrl;
@@ -65,6 +76,8 @@ async function init() {
 
 function save() {
 	os.apiWithDialog('admin/update-meta', {
+		disableRegistration: !enableRegistration,
+		emailRequiredForSignup,
 		tosUrl,
 		sensitiveWords: sensitiveWords.split('\n'),
 		preservedUsernames: preservedUsernames.split('\n'),
diff --git a/packages/frontend/src/pages/admin/settings.vue b/packages/frontend/src/pages/admin/settings.vue
index e9de6f7b0e..0bf7d772de 100644
--- a/packages/frontend/src/pages/admin/settings.vue
+++ b/packages/frontend/src/pages/admin/settings.vue
@@ -31,14 +31,6 @@
 
 					<FormSection>
 						<div class="_gaps_s">
-							<MkSwitch v-model="enableRegistration">
-								<template #label>{{ i18n.ts.enableRegistration }}</template>
-							</MkSwitch>
-
-							<MkSwitch v-model="emailRequiredForSignup">
-								<template #label>{{ i18n.ts.emailRequiredForSignup }}</template>
-							</MkSwitch>
-
 							<MkSwitch v-model="enableChartsForRemoteUser">
 								<template #label>{{ i18n.ts.enableChartsForRemoteUser }}</template>
 							</MkSwitch>
@@ -174,8 +166,6 @@ let defaultLightTheme: any = $ref(null);
 let defaultDarkTheme: any = $ref(null);
 let pinnedUsers: string = $ref('');
 let cacheRemoteFiles: boolean = $ref(false);
-let enableRegistration: boolean = $ref(false);
-let emailRequiredForSignup: boolean = $ref(false);
 let enableServiceWorker: boolean = $ref(false);
 let enableChartsForRemoteUser: boolean = $ref(false);
 let enableChartsForFederatedInstances: boolean = $ref(false);
@@ -198,8 +188,6 @@ async function init() {
 	maintainerEmail = meta.maintainerEmail;
 	pinnedUsers = meta.pinnedUsers.join('\n');
 	cacheRemoteFiles = meta.cacheRemoteFiles;
-	enableRegistration = !meta.disableRegistration;
-	emailRequiredForSignup = meta.emailRequiredForSignup;
 	enableServiceWorker = meta.enableServiceWorker;
 	enableChartsForRemoteUser = meta.enableChartsForRemoteUser;
 	enableChartsForFederatedInstances = meta.enableChartsForFederatedInstances;
@@ -223,8 +211,6 @@ function save() {
 		maintainerEmail,
 		pinnedUsers: pinnedUsers.split('\n'),
 		cacheRemoteFiles,
-		disableRegistration: !enableRegistration,
-		emailRequiredForSignup,
 		enableServiceWorker,
 		enableChartsForRemoteUser,
 		enableChartsForFederatedInstances,