From 5cd11cacdcc73a4884c520989a1150fac7a8de83 Mon Sep 17 00:00:00 2001 From: Marie Date: Sat, 14 Sep 2024 14:11:12 +0200 Subject: [PATCH] upd: apply suggestions --- locales/en-US.yml | 12 +++++----- locales/ja-JP.yml | 12 +++++----- .../backend/src/models/json-schema/meta.ts | 2 +- .../src/server/StripeHookServerService.ts | 4 +++- packages/frontend/src/config.ts | 2 +- packages/frontend/src/nirax.ts | 8 +++---- .../frontend/src/pages/welcome.entrance.a.vue | 2 +- packages/frontend/src/router/definition.ts | 22 ++++++++++++------- packages/misskey-js/src/autogen/types.ts | 2 +- 9 files changed, 37 insertions(+), 29 deletions(-) diff --git a/locales/en-US.yml b/locales/en-US.yml index f591cbed48..1ffe80b21f 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -2820,10 +2820,10 @@ _contextMenu: native: "Native" _stripeAgeCheck: - startText: We require you to confirm your identity, Please press the start button to begin the process - beginProcess: Press the open Stripe in new tab button to begin Identification through Stripe - endProcess: If you have completed the Stripe verification process, wait a few seconds and then click Confirm completion. + startText: "We require you to confirm your identity, Please press the start button to begin the process" + beginProcess: "Press the open Stripe in new tab button to begin Identification through Stripe" + endProcess: "If you have completed the Stripe verification process, wait a few seconds and then click Confirm completion." _buttons: - start: Start Verification - openInNewTab: Open Stripe in new tab - confirmFinish: Confirm completion + start: "Start Verification" + openInNewTab: "Open Stripe in new tab" + confirmFinish: "Confirm completion" diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 668d94c531..57bc165509 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -2895,10 +2895,10 @@ _contextMenu: native: "ブラウザのUI" _stripeAgeCheck: - startText: ご本人様確認をさせていただきますので、スタートボタンを押して手続きを開始してください。 - beginProcess: 新しいタブでStripeを開くボタンを押すと、Stripeでの本人確認が開始されます。 - endProcess: Stripeでの本人確認手続きが完了した場合は、数秒待ってから完了をクリックしてください。 + startText: "ご本人様確認をさせていただきますので、スタートボタンを押して手続きを開始してください。" + beginProcess: "新しいタブでStripeを開くボタンを押すと、Stripeでの本人確認が開始されます。" + endProcess: "Stripeでの本人確認手続きが完了した場合は、数秒待ってから完了をクリックしてください。" _buttons: - start: 検証を開始する - openInNewTab: 新しいタブでStripeを開く - confirmFinish: 完成を確認する + start: "検証を開始する" + openInNewTab: "新しいタブでStripeを開く" + confirmFinish: "完成を確認する" diff --git a/packages/backend/src/models/json-schema/meta.ts b/packages/backend/src/models/json-schema/meta.ts index 352fd2adfa..2ae33c5a8c 100644 --- a/packages/backend/src/models/json-schema/meta.ts +++ b/packages/backend/src/models/json-schema/meta.ts @@ -278,7 +278,7 @@ export const packedMetaDetailedOnlySchema = { properties: { features: { type: 'object', - optional: false, nullable: false, + optional: true, nullable: false, properties: { registration: { type: 'boolean', diff --git a/packages/backend/src/server/StripeHookServerService.ts b/packages/backend/src/server/StripeHookServerService.ts index 1e6af8acc4..723ebdac47 100644 --- a/packages/backend/src/server/StripeHookServerService.ts +++ b/packages/backend/src/server/StripeHookServerService.ts @@ -131,7 +131,9 @@ export class StripeHookServerService { this.logger.succ(`${user.username} has failed ID Verification via Session ${verificationSession.id}`); - await this.usersRepository.update(user.id, { idCheckRequired: false }); + + // If general instance then unset idCheckRequired as to prevent locking the user out forever admins/mods can see the mod note in case of the failure + if (!this.config.stripeAgeCheck.required) await this.usersRepository.update(user.id, { idCheckRequired: false }); await this.userProfilesRepository.update(user.id, { moderationNote: 'ADM/IDFAIL: Possibly underage' }); diff --git a/packages/frontend/src/config.ts b/packages/frontend/src/config.ts index cf2bc1df7d..508e72204a 100644 --- a/packages/frontend/src/config.ts +++ b/packages/frontend/src/config.ts @@ -21,7 +21,7 @@ export const version = _VERSION_; export const instanceName = siteName === 'Sharkey' || siteName == null ? host : siteName; export const ui = miLocalStorage.getItem('ui'); export const debug = miLocalStorage.getItem('debug') === 'true'; -export const idRequired: any = document.querySelector('meta[property="idRequired"]')?.content === 'true' ? true : false; +export const idRequired = document.querySelector('meta[property="idRequired"]')?.content === 'true' ? true : false; export function updateLocale(newLocale): void { locale = newLocale; diff --git a/packages/frontend/src/nirax.ts b/packages/frontend/src/nirax.ts index 58693fb2b2..bd91e51736 100644 --- a/packages/frontend/src/nirax.ts +++ b/packages/frontend/src/nirax.ts @@ -187,14 +187,14 @@ export class Router extends EventEmitter implements IRouter { public currentRoute: ShallowRef; private currentPath: string; private isLoggedIn: boolean; - private isNotIdConfirmed: boolean; + private isIdConfirmed: boolean; private notFoundPageComponent: Component; private currentKey = Date.now().toString(); private redirectCount = 0; public navHook: ((path: string, flag?: any) => boolean) | null = null; - constructor(routes: Router['routes'], currentPath: Router['currentPath'], isLoggedIn: boolean, isNotIdConfirmed: boolean, notFoundPageComponent: Component) { + constructor(routes: Router['routes'], currentPath: Router['currentPath'], isLoggedIn: boolean, isIdConfirmed: boolean, notFoundPageComponent: Component) { super(); this.routes = routes; @@ -203,7 +203,7 @@ export class Router extends EventEmitter implements IRouter { this.currentRoute = shallowRef(this.current.route); this.currentPath = currentPath; this.isLoggedIn = isLoggedIn; - this.isNotIdConfirmed = isNotIdConfirmed; + this.isIdConfirmed = isIdConfirmed; this.notFoundPageComponent = notFoundPageComponent; } @@ -369,7 +369,7 @@ export class Router extends EventEmitter implements IRouter { res.props.set('showLoginPopup', true); } - if (res.route.idRequired && this.isNotIdConfirmed) { + if (res.route.idRequired && !this.isIdConfirmed) { res.route.component = this.notFoundPageComponent; res.props.set('showIdConfirm', true); } diff --git a/packages/frontend/src/pages/welcome.entrance.a.vue b/packages/frontend/src/pages/welcome.entrance.a.vue index 83496882ef..48ed8c3e46 100644 --- a/packages/frontend/src/pages/welcome.entrance.a.vue +++ b/packages/frontend/src/pages/welcome.entrance.a.vue @@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only