Skip to content

Commit

Permalink
add: locales for approval feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Mar0xy authored and kakkokari-gtyih committed Dec 29, 2023
1 parent f69b50a commit e16433b
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 11 deletions.
10 changes: 10 additions & 0 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ export interface Locale {
"blockConfirm": string;
"unblockConfirm": string;
"suspendConfirm": string;
"approveConfirm": string;
"unsuspendConfirm": string;
"selectList": string;
"editList": string;
Expand Down Expand Up @@ -875,6 +876,7 @@ export interface Locale {
"on": string;
"off": string;
"emailRequiredForSignup": string;
"approvalRequiredForSignup": string;
"unread": string;
"filter": string;
"controlPanel": string;
Expand Down Expand Up @@ -933,6 +935,11 @@ export interface Locale {
"isSystemAccount": string;
"typeToConfirm": string;
"deleteAccount": string;
"approveAccount": string;
"denyAccount": string;
"approved": string;
"notApproved": string;
"approvalStatus": string;
"document": string;
"numberOfPageCache": string;
"numberOfPageCacheDescription": string;
Expand Down Expand Up @@ -1023,6 +1030,7 @@ export interface Locale {
"disableFederationConfirmWarn": string;
"disableFederationOk": string;
"invitationRequiredToRegister": string;
"approvalRequiredToRegister": string;
"emailNotSupported": string;
"postToTheChannel": string;
"cannotBeChangedLater": string;
Expand Down Expand Up @@ -1758,6 +1766,8 @@ export interface Locale {
"almostThere": string;
"emailAddressInfo": string;
"emailSent": string;
"approvalPending": string;
"reasonInfo": string;
};
"_accountDelete": {
"accountDelete": string;
Expand Down
10 changes: 10 additions & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ unsuspend: "解凍"
blockConfirm: "ブロックしますか?"
unblockConfirm: "ブロック解除しますか?"
suspendConfirm: "凍結しますか?"
approveConfirm: "このアカウントを承認してもよろしいですか?"
unsuspendConfirm: "解凍しますか?"
selectList: "リストを選択"
editList: "リストを編集"
Expand Down Expand Up @@ -872,6 +873,7 @@ itsOff: "オフになっています"
on: "オン"
off: "オフ"
emailRequiredForSignup: "アカウント登録にメールアドレスを必須にする"
approvalRequiredForSignup: "新規ユーザーの承認が必要"
unread: "未読"
filter: "フィルタ"
controlPanel: "コントロールパネル"
Expand Down Expand Up @@ -930,6 +932,11 @@ requireAdminForView: "閲覧するには管理者アカウントでログイン
isSystemAccount: "システムにより自動で作成・管理されているアカウントです。"
typeToConfirm: "この操作を行うには {x} と入力してください"
deleteAccount: "アカウント削除"
approveAccount: "承認する"
denyAccount: "拒否と削除"
approved: "承認済み"
notApproved: "承認されていない"
approvalStatus: "承認状況"
document: "ドキュメント"
numberOfPageCache: "ページキャッシュ数"
numberOfPageCacheDescription: "多くすると利便性が向上しますが、負荷とメモリ使用量が増えます。"
Expand Down Expand Up @@ -1020,6 +1027,7 @@ disableFederationConfirm: "連合なしにしますか?"
disableFederationConfirmWarn: "連合なしにしても投稿は非公開になりません。ほとんどの場合、連合なしにする必要はありません。"
disableFederationOk: "連合なしにする"
invitationRequiredToRegister: "現在このサーバーは招待制です。招待コードをお持ちの方のみ登録できます。"
approvalRequiredToRegister: "このインスタンスは、登録理由を指定したユーザーのみを受け入れています。"
emailNotSupported: "このサーバーではメール配信はサポートされていません"
postToTheChannel: "チャンネルに投稿"
cannotBeChangedLater: "後から変更できません。"
Expand Down Expand Up @@ -1665,6 +1673,8 @@ _signup:
almostThere: "ほとんど完了です"
emailAddressInfo: "あなたが使っているメールアドレスを入力してください。メールアドレスが公開されることはありません。"
emailSent: "入力されたメールアドレス({email})宛に確認のメールが送信されました。メールに記載されたリンクにアクセスすると、アカウントの作成が完了します。メールに記載されているリンクの有効期限は30分です。"
approvalPending: "アカウントが作成され、承認待ちの状態です。"
reasonInfo: "このサーバーに参加したい理由を入力してください。"

_accountDelete:
accountDelete: "アカウントの削除"
Expand Down
6 changes: 3 additions & 3 deletions packages/frontend/src/components/MkSignupDialog.form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
</MkInput>
<MkInput v-if="instance.approvalRequiredForSignup" v-model="reason" type="text" :spellcheck="false" required data-cy-signup-reason>
<template #label>Reason <div v-tooltip:dialog="i18n.ts._signup.emailAddressInfo" class="_button _help"><i class="ph-question ph-bold ph-lg"></i></div></template>
<template #prefix><i class="ph-envelope ph-bold ph-lg"></i></template>
<template #label>Reason <div v-tooltip:dialog="i18n.ts._signup.reasonInfo" class="_button _help"><i class="ph-question ph-bold ph-lg"></i></div></template>
<template #prefix><i class="ph-chalkboard-teacher ph-bold ph-lg"></i></template>
</MkInput>
<MkCaptcha v-if="instance.enableHcaptcha" ref="hcaptcha" v-model="hCaptchaResponse" :class="$style.captcha" provider="hcaptcha" :sitekey="instance.hcaptchaSiteKey"/>
<MkCaptcha v-if="instance.enableRecaptcha" ref="recaptcha" v-model="reCaptchaResponse" :class="$style.captcha" provider="recaptcha" :sitekey="instance.recaptchaSiteKey"/>
Expand Down Expand Up @@ -272,7 +272,7 @@ async function onSubmit(): Promise<void> {
os.alert({
type: 'success',
title: i18n.ts._signup.almostThere,
text: i18n.t('_signup.emailSent', { email }),
text: i18n.ts._signup.approvalPending,
});
emit('approvalPending');
} else {
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/components/MkVisitorDashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkInfo warn>{{ i18n.ts.invitationRequiredToRegister }}</MkInfo>
</div>
<div v-if="instance.approvalRequiredForSignup" :class="$style.mainWarn">
<MkInfo warn>This instance is only accepting users who specify a reason for registration.<br />You must enter a reason during sign up as to why you want to join this instance.</MkInfo>
<MkInfo warn>{{ i18n.ts.approvalRequiredToRegister }}</MkInfo>
</div>
<div class="_gaps_s" :class="$style.mainActions">
<MkButton :class="$style.mainAction" full rounded gradate data-cy-signup style="margin-right: 12px;" @click="signup()">{{ i18n.ts.joinThisServer }}</MkButton>
Expand Down
13 changes: 7 additions & 6 deletions packages/frontend/src/pages/admin-user.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ SPDX-License-Identifier: AGPL-3.0-only
<span class="name"><MkUserName class="name" :user="user"/></span>
<span class="sub"><span class="acct _monospace">@{{ acct(user) }}</span></span>
<span class="state">
<span v-if="!approved" class="silenced">Not Approved</span>
<span v-if="!approved" class="silenced">{{ i18n.ts.notApproved }}</span>
<span v-if="approved" class="moderator">{{ i18n.ts.approved }}</span>
<span v-if="suspended" class="suspended">Suspended</span>
<span v-if="silenced" class="silenced">Silenced</span>
<span v-if="moderator" class="moderator">Moderator</span>
Expand Down Expand Up @@ -201,16 +202,16 @@ SPDX-License-Identifier: AGPL-3.0-only

<div v-else-if="tab === 'approval'" class="_gaps_m">
<MkKeyValue oneline>
<template #key>Approval Status</template>
<template #value><span class="_monospace">{{ approved ? 'Approved' : 'Not Approved' }}</span></template>
<template #key>{{ i18n.ts.approvalStatus }}</template>
<template #value><span class="_monospace">{{ approved ? {{ i18n.ts.approved }} : {{ i18n.ts.notApproved }} }}</span></template>
</MkKeyValue>

<MkTextarea v-model="signupReason" readonly>
<template #label>Reason</template>
</MkTextarea>

<MkButton v-if="$i.isAdmin" inline success @click="approveAccount">Approve</MkButton>
<MkButton v-if="$i.isAdmin" inline danger @click="deleteAccount">Deny & Delete</MkButton>
<MkButton v-if="$i.isAdmin" inline success @click="approveAccount">{{ i18n.ts.approveAccount }}</MkButton>
<MkButton v-if="$i.isAdmin" inline danger @click="deleteAccount">{{ i18n.ts.denyAccount }}</MkButton>
</div>
</FormSuspense>
</MkSpacer>
Expand Down Expand Up @@ -427,7 +428,7 @@ async function deleteAccount() {
async function approveAccount() {
const confirm = await os.confirm({
type: 'warning',
text: i18n.ts.suspendConfirm,
text: i18n.ts.approveConfirm,
});
if (confirm.canceled) return;
await os.api('admin/approve-user', { userId: user.id });
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/pages/admin/moderation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</MkSwitch>

<MkSwitch v-model="approvalRequiredForSignup">
<template #label>Require approval for new sign-ups</template>
<template #label>{{ i18n.ts.approvalRequiredForSignup }}</template>
</MkSwitch>

<FormLink to="/admin/server-rules">{{ i18n.ts.serverRules }}</FormLink>
Expand Down

0 comments on commit e16433b

Please sign in to comment.