From 058457160520c83e640ee9bc8f6c6bbbe58fd930 Mon Sep 17 00:00:00 2001 From: kakkokari-gtyih <67428053+kakkokari-gtyih@users.noreply.github.com> Date: Thu, 14 Nov 2024 16:38:51 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=A8=E3=83=A9=E3=83=BC=E3=81=AE=E8=A9=B3?= =?UTF-8?q?=E7=B4=B0=E3=82=92=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locales/index.d.ts | 8 +++++++ locales/ja-JP.yml | 2 ++ packages/frontend/src/pages/reversi/index.vue | 24 ++++++++++++++++--- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/locales/index.d.ts b/locales/index.d.ts index e5f598a903..e9104d1568 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -10414,6 +10414,14 @@ export interface Locale extends ILocale { * 石をアイコンにする */ "useAvatarAsStone": string; + /** + * 相手のユーザーにはMisskey Gamesをプレイする権限がありません。 + */ + "targetUserIsNotAvailable": string; + /** + * 相手に自分自身を指定することはできません。 + */ + "targetIsYourself": string; }; "_offlineScreen": { /** diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 4fbdba479e..a83e4a6d9c 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -2769,6 +2769,8 @@ _reversi: disallowIrregularRules: "変則なし" showBoardLabels: "盤面に行・列番号を表示" useAvatarAsStone: "石をアイコンにする" + targetUserIsNotAvailable: "相手のユーザーにはMisskey Gamesをプレイする権限がありません。" + targetIsYourself: "相手に自分自身を指定することはできません。" _offlineScreen: title: "オフライン - サーバーに接続できません" diff --git a/packages/frontend/src/pages/reversi/index.vue b/packages/frontend/src/pages/reversi/index.vue index 2da150018b..ed85babb03 100644 --- a/packages/frontend/src/pages/reversi/index.vue +++ b/packages/frontend/src/pages/reversi/index.vue @@ -196,15 +196,33 @@ async function matchHeatbeat() { } function onApiError(err) { - if (err.id === '7f86f06f-7e15-4057-8561-f4b6d4ac755a') { + if (err.id != null) { + let title: string | null = null; + let text = i18n.ts.somethingHappened; + + switch (err.id) { + case '7f86f06f-7e15-4057-8561-f4b6d4ac755a': + title = i18n.ts.permissionDeniedError; + text = i18n.ts.permissionDeniedErrorDescription; + break; + case '3a8a677f-98e5-4c4d-b059-e5874b44bd4f': + title = i18n.ts.somethingHappened; + text = i18n.ts._reversi.targetUserIsNotAvailable; + break; + case '96fd7bd6-d2bc-426c-a865-d055dcd2828e': + title = i18n.ts.somethingHappened; + text = i18n.ts._reversi.targetIsYourself; + break; + } + // Role permission error matchingUser.value = null; matchingAny.value = false; os.alert({ type: 'error', - title: i18n.ts.permissionDeniedError, - text: i18n.ts.permissionDeniedErrorDescription, + title: title ?? undefined, + text, }); } return null;