Skip to content

Commit

Permalink
Display a message box, when an operation cannot be completed, because…
Browse files Browse the repository at this point in the history
… you're banned.
  • Loading branch information
smelamud committed Jul 9, 2023
1 parent fbead63 commit 1af13f6
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
6 changes: 6 additions & 0 deletions src/api/node/call.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { apply, call, put, select } from 'typed-redux-saga';
import { CallEffect, PutEffect, SelectEffect } from 'redux-saga/effects';
import { ValidateFunction } from 'ajv';
import i18n from 'i18next';

import { formatSchemaErrors, HomeNotConnectedError, NameResolvingError, NodeApi, NodeApiError, NodeError } from "api";
import { retryFetch } from "api/fetch-timeout";
Expand Down Expand Up @@ -29,6 +30,7 @@ import { ProgressHandler } from "api/fetcher";
import { BodyError } from "api/error";
import { isSchemaValid } from "api/schema";
import { errorAuthInvalid } from "state/error/actions";
import { messageBox } from "state/messagebox/actions";
import { getNodeRootLocation, getToken } from "state/node/selectors";
import { getCurrentAllCarte } from "state/cartes/selectors";
import { getHomeRootLocation, isConnectedToHome } from "state/home/selectors";
Expand Down Expand Up @@ -124,6 +126,10 @@ export function* callApi<T>({
yield* put(errorAuthInvalid());
throw new NodeApiError(data.errorCode, data.message);
}
if (data.errorCode === "authentication.blocked") {
yield* put(messageBox(i18n.t("sorry-you-banned")));
throw new NodeApiError(data.errorCode, data.message);
}
if (data.errorCode.startsWith("carte.") && !cartesRenewed) {
const error = yield* call(cartesRenew);
if (error != null) {
Expand Down
3 changes: 2 additions & 1 deletion src/i18n/locales/en/message.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"connect-home" : "Connect to Home",
"connecting" : "Connecting",
"content-hidden-in-google-play" : "All content is hidden in Android (Google Play)",
"content-not-accessible-android" : "This content is not accessible on Android.",
"content-not-accessible-android" : "This content is not accessible on Android",
"content-unhidden-in-google-play" : "All content is unhidden in Android (Google Play)",
"continue-reading" : "Continue Reading →",
"copy" : "Copy",
Expand Down Expand Up @@ -757,6 +757,7 @@
"signature-verification-in-progress" : "Signature verification in progress",
"sign-up" : "Sign Up",
"size" : "Size",
"sorry-you-banned" : "Sorry, you cannot perform this operation, because the author has banned you.",
"spoiler" : "Spoiler",
"spoiler-alert" : "spoiler!",
"stop-asking" : "Stop asking",
Expand Down
4 changes: 2 additions & 2 deletions src/i18n/locales/pl/message.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"add-comment" : "Dodaj komentarz",
"add-comments-need" : "Aby dodać komentarze, musisz się <0>zarejestrować</0> lub <1>połączyć</1>",
"add-comments-need" : "Aby dodać komentarze, musisz się <0>{signup}</0> lub <1>{connect}</1>",
"add-connection" : "Dodaj połączenie",
"add-donation" : "Dodaj darowiznę",
"add-donation-button" : "Dodaj darowiznę",
Expand Down Expand Up @@ -98,7 +98,7 @@
"connected" : "Połączono",
"connect-home" : "Połącz z domem",
"connecting" : "Łączenie",
"content-not-accessible-android" : "Ten kontent nie jest dostępny na Androidzie.",
"content-not-accessible-android" : "Ten kontent nie jest dostępny na Androidzie",
"continue-reading" : "Kontynuuj czytanie →",
"copy" : "Kopiuj",
"copy-image-from-internet" : "Kopiuj obraz z internetu",
Expand Down
3 changes: 2 additions & 1 deletion src/i18n/locales/ru/message.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"connect-home" : "Подключиться к дому",
"connecting" : "Подключение",
"content-hidden-in-google-play" : "Весь контент скрыт в Android (Google Play)",
"content-not-accessible-android" : "Этот контент недоступен на Android.",
"content-not-accessible-android" : "Этот контент недоступен на Android",
"content-unhidden-in-google-play" : "Весь контент раскрыт в Android (Google Play)",
"continue-reading" : "Читать дальше →",
"copy" : "Копировать",
Expand Down Expand Up @@ -757,6 +757,7 @@
"signature-verification-in-progress" : "Идёт проверка подписи",
"sign-up" : "Регистрация",
"size" : "Размер",
"sorry-you-banned" : "К сожалению, вы не можете выполнить эту операцию, так как автор забанил вас.",
"spoiler" : "Спойлер",
"spoiler-alert" : "спойлер!",
"stop-asking" : "Больше не спрашивать",
Expand Down
3 changes: 2 additions & 1 deletion src/i18n/locales/uk/message.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"connect-home" : "Підключитись до дому",
"connecting" : "Підключення",
"content-hidden-in-google-play" : "Весь контент приховано у Android (Google Play)",
"content-not-accessible-android" : "Цей контент недоступний на Android.",
"content-not-accessible-android" : "Цей контент недоступний на Android",
"content-unhidden-in-google-play" : "Весь контент розкрито у Android (Google Play)",
"continue-reading" : "Читати далі →",
"copy" : "Копіювати",
Expand Down Expand Up @@ -757,6 +757,7 @@
"signature-verification-in-progress" : "Йде перевірка підпису",
"sign-up" : "Реєстрація",
"size" : "Розмір",
"sorry-you-banned" : "На жаль, ви не можете здійснити цю операцію, оскільки автор забанив вас.",
"spoiler" : "Спойлер",
"spoiler-alert" : "спойлер!",
"stop-asking" : "Припинити питати",
Expand Down

0 comments on commit 1af13f6

Please sign in to comment.