Added a "app.warn" ns in locales for warning messages instead of all error

This commit is contained in:
Niko 2022-02-21 22:27:28 +01:00
parent b50bd5621a
commit 9f587750eb
4 changed files with 17 additions and 9 deletions

View File

@ -174,7 +174,7 @@ module.exports = {
const follow = await httpGetValidFollow(req, res)
if (follow !== null) {
if (follow.accepted)
return res.json({ error: 'already_following' })
return res.json({ warn: 'already_following' })
return res.json({ error: 'follow_pending' })
}

View File

@ -165,7 +165,9 @@ app.pages.meet = {
return app.toast.error(s('app.error.unknown_error'));
http.post(`/api/v1/accounts/follow?url=${current.account.url}`, {}, function(json) {
if (json === undefined) return;
if (json.error !== undefined)
if (json.warn !== undefined)
app.toast.warn(app.strings.app.warn[json.warn]);
else if (json.error !== undefined)
app.toast.error(app.strings.app.error[json.error]);
else if (json.result !== undefined && json.result === 1) {
const n = randomNum(0, 3);
@ -180,7 +182,9 @@ app.pages.meet = {
return app.toast.error(s('app.error.unknown_error'));
http.post(`/api/v1/accounts/block?url=${current.account.url}`, {}, function(json) {
if (json === undefined) return;
if (json.error !== undefined)
if (json.warn !== undefined)
app.toast.warn(app.strings.app.warn[json.warn]);
else if (json.error !== undefined)
app.toast.error(app.strings.app.error[json.error]);
else if (json.result !== undefined && json.result === 1) {
const n = randomNum(0, 3);

View File

@ -27,12 +27,14 @@ $strings = [
'discarded_success_2' => 'Maybe other person like you, but not me',
'discarded_success_3' => 'You\'ll find someone, but it won\'t be me',
],
'warn' => [
'already_following' => 'This person has already accepted being your crush',
],
'error' => [
'unknown_error' => 'We are sorry, an unknown error has ocurred.',
'already_following' => 'This person is your Crush already',
'follow_pending' => 'Your Crush didn\'t accept you as a crush yet',
'follow_pending' => 'This person has not yet accepted to be your crush',
'follow_rejected_max' => 'You have reached the limit of crush requests on this person',
'user_blocked_you' => 'We are sorry, this person rejected your crush request. You will find another person for sure!',
'user_blocked_you' => 'We are sorry, this person rejected to be your crush. You will find another love soon!',
],
],
];

View File

@ -27,12 +27,14 @@ $strings = [
'discarded_success_2' => 'Quizás le guste a otra persona, pero a mi no',
'discarded_success_3' => 'Encontrarás a alguien, pero no seré yo',
],
'warn' => [
'already_following' => 'Esta persona ya te ha aceptado como su crush',
],
'error' => [
'unknown_error' => 'Lo sentimos, ha ocurrido un error inesperado.',
'already_following' => 'Esta persona ya es tu Crush',
'follow_pending' => 'Tu Crush todavía no te considera un crush',
'follow_pending' => 'Esta persona todavía no ha aceptado ser tu crush',
'follow_rejected_max' => 'Has alcanzado el límite de peticiones de crush para esta persona',
'user_blocked_you' => 'Lo sentimos, esta persona ha rechazado tu petición de crush. ¡Encontrarás a otra persona seguro!',
'user_blocked_you' => 'Lo sentimos, esta persona ha rechazado ser su crush. ¡Encontrarás a otra persona pronto!',
],
],
];