mirror of
https://github.com/wassname/talk.git
synced 2026-07-04 19:50:17 +08:00
Restore error functionality
This commit is contained in:
@@ -23,7 +23,7 @@ export const handleLogin = (email, password, recaptchaResponse) => (dispatch) =>
|
||||
dispatch(checkLoginSuccess(user));
|
||||
})
|
||||
.catch((error) => {
|
||||
if (error.translation_key === 'login_maximum_exceeded') {
|
||||
if (error.translation_key === 'LOGIN_MAXIMUM_EXCEEDED') {
|
||||
dispatch({
|
||||
type: actions.LOGIN_MAXIMUM_EXCEEDED,
|
||||
message: error.translation_key
|
||||
|
||||
@@ -36,7 +36,7 @@ export class CountdownSeconds extends React.Component {
|
||||
const secRemaining = msRemaining / 1000;
|
||||
const wholeSecRemaining = Math.floor(secRemaining);
|
||||
const plural = secRemaining !== 1;
|
||||
const units = t(plural ? 'edit_comment.secondsPlural' : 'edit_comment.second');
|
||||
const units = t(plural ? 'edit_comment.seconds_plural' : 'edit_comment.second');
|
||||
let classFromProp;
|
||||
if (typeof classNameForMsRemaining === 'function') {
|
||||
classFromProp = classNameForMsRemaining(msRemaining);
|
||||
|
||||
@@ -83,9 +83,9 @@ export class EditableCommentContent extends React.Component {
|
||||
if (error.translation_key) {
|
||||
addNotification('error', t(`error.${error.translation_key}`));
|
||||
} else if (error.networkError) {
|
||||
addNotification('error', t('error.networkError'));
|
||||
addNotification('error', t('error.network_error'));
|
||||
} else {
|
||||
addNotification('error', t('edit_comment.unexpectedError'));
|
||||
addNotification('error', t('edit_comment.unexpected_error'));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -114,7 +114,7 @@ export class EditableCommentContent extends React.Component {
|
||||
return (comment.body !== originalBody) && !editWindowExpired;
|
||||
}}
|
||||
saveComment={this.editComment}
|
||||
bodyLabel={t('edit_comment.bodyInputLabel')}
|
||||
bodyLabel={t('edit_comment.body_input_label')}
|
||||
bodyPlaceholder=""
|
||||
submitText={<span>{t('edit_comment.save_button')}</span>}
|
||||
saveButtonCStyle="green"
|
||||
@@ -126,15 +126,15 @@ export class EditableCommentContent extends React.Component {
|
||||
{
|
||||
editWindowExpired
|
||||
? <span>
|
||||
{t('edit_comment.editWindowExpired')}
|
||||
{t('edit_comment.edit_window_expired')}
|
||||
{
|
||||
typeof this.props.stopEditing === 'function'
|
||||
? <span> <a className={styles.link} onClick={this.props.stopEditing}>{t('edit_comment.editWindowExpiredClose')}</a></span>
|
||||
? <span> <a className={styles.link} onClick={this.props.stopEditing}>{t('edit_comment.edit_window_expired_close')}</a></span>
|
||||
: null
|
||||
}
|
||||
</span>
|
||||
: <span>
|
||||
<Icon name="timer"/> {t('edit_comment.editWindowTimerPrefix')}
|
||||
<Icon name="timer"/> {t('edit_comment.edit_window_timer_prefix')}
|
||||
<CountdownSeconds
|
||||
until={editableUntil}
|
||||
classNameForMsRemaining={(remainingMs) => (remainingMs <= 10 * 1000) ? styles.editWindowAlmostOver : '' }
|
||||
|
||||
@@ -40,7 +40,7 @@ const ErrPasswordTooShort = new APIError('password must be at least 8 characters
|
||||
});
|
||||
|
||||
const ErrMissingEmail = new APIError('email is required', {
|
||||
translation_key: 'email_required',
|
||||
translation_key: 'EMAIL_REQUIRED',
|
||||
status: 400
|
||||
});
|
||||
|
||||
@@ -50,7 +50,7 @@ const ErrMissingPassword = new APIError('password is required', {
|
||||
});
|
||||
|
||||
const ErrEmailTaken = new APIError('Email address already in use', {
|
||||
translation_key: 'email_in_use',
|
||||
translation_key: 'EMAIL_IN_USE',
|
||||
status: 400
|
||||
});
|
||||
|
||||
@@ -146,13 +146,13 @@ const ErrInstallLock = new APIError('install lock active', {
|
||||
|
||||
// ErrPermissionUpdateUsername is returned when the user does not have permission to update their username.
|
||||
const ErrPermissionUpdateUsername = new APIError('You do not have permission to update your username.', {
|
||||
translation_key: 'edit_username_not_authorized',
|
||||
translation_key: 'EDIT_USERNAME_NOT_AUTHORIZED',
|
||||
status: 500
|
||||
});
|
||||
|
||||
// ErrLoginAttemptMaximumExceeded is returned when the login maximum is exceeded.
|
||||
const ErrLoginAttemptMaximumExceeded = new APIError('You have made too many incorrect password attempts.', {
|
||||
translation_key: 'login_maximum_exceeded',
|
||||
translation_key: 'LOGIN_MAXIMUM_EXCEEDED',
|
||||
status: 429
|
||||
});
|
||||
|
||||
|
||||
+17
-15
@@ -151,38 +151,40 @@ en:
|
||||
no_likes: "There have been no likes in the last 5 minutes. All quiet."
|
||||
done: Done
|
||||
edit_comment:
|
||||
bodyInputLabel: "Edit this comment"
|
||||
body_input_label: "Edit this comment"
|
||||
save_button: "Save changes"
|
||||
editWindowExpired: "You can no longer edit this comment. The time window to do so has expired. Why not post another one?"
|
||||
editWindowExpiredClose: "Close"
|
||||
editWindowTimerPrefix: "Edit Window: "
|
||||
edit_window_expired: "You can no longer edit this comment. The time window to do so has expired. Why not post another one?"
|
||||
edit_window_expired_close: "Close"
|
||||
edit_window_timer_prefix: "Edit Window: "
|
||||
second: "second"
|
||||
secondsPlural: "seconds"
|
||||
unexpectedError: "Unexpected error while saving changes. Sorry!"
|
||||
seconds_plural: "seconds"
|
||||
unexpected_error: "Unexpected error while saving changes. Sorry!"
|
||||
embedlink:
|
||||
copy: "Copy to Clipboard"
|
||||
error:
|
||||
comment_too_short: "Your comment must have something in it"
|
||||
COMMENT_TOO_SHORT: "Your comment must have something in it"
|
||||
NOT_AUTHORIZED: "Your username or password is not recognized by our system."
|
||||
NO_SPECIAL_CHARACTERS: "Usernames can contain letters numbers and _ only"
|
||||
PASSWORD_LENGTH: "Password is too short"
|
||||
PROFANITY_ERROR: "Usernames must not contain profanity. Please contact the administrator if you believe this to be in error."
|
||||
USERNAME_IN_USE: "Username already in use"
|
||||
USERNAME_REQUIRED: "Must input a username"
|
||||
confirm_password: "Passwords don't match. Please check again"
|
||||
edit_window_ended: "You can no longer edit this comment. The time window to do so has expired."
|
||||
edit_username_not_authorized: "You do not have permission to update your username."
|
||||
EDIT_WINDOW_ENDED: "You can no longer edit this comment. The time window to do so has expired."
|
||||
EDIT_USERNAME_NOT_AUTHORIZED: "You do not have permission to update your username."
|
||||
EMAIL_IN_USE: "Email address already in use"
|
||||
EMAIL_REQUIRED: "An email address is required"
|
||||
LOGIN_MAXIMUM_EXCEEDED: "You have made too many unsuccessful password attempts. Please wait."
|
||||
PASSWORD_REQUIRED: "Must input a password"
|
||||
COMMENTING_CLOSED: "Commenting is already closed"
|
||||
NOT_FOUND: "Resource not found"
|
||||
INVALID_ASSET_URL: "Assert URL is invalid"
|
||||
email: "Not a valid E-Mail"
|
||||
confirm_password: "Passwords don't match. Please check again"
|
||||
network_error: "Failed to connect to server. Check your internet connection and try again."
|
||||
email_in_use: "Email address already in use"
|
||||
email_not_verified: "E-mail address {0} not verified."
|
||||
email_password: "E-mail and/or password combination incorrect."
|
||||
email_required: "An email address is required"
|
||||
email_username_in_use: "Email address or username already in use"
|
||||
login_maximum_exceeded: "You have made too many unsuccessful password attempts. Please wait."
|
||||
organization_name: "Organization name must only contain letters or numbers."
|
||||
password: "Password must be at least 8 characters"
|
||||
password_required: "Must input a password"
|
||||
username: "Usernames can contain letters numbers and _ only"
|
||||
flag_comment: "Report comment"
|
||||
flag_reason: "Reason for reporting (Optional)"
|
||||
|
||||
+18
-16
@@ -185,19 +185,19 @@ es:
|
||||
no_likes: "¡No ha habido ningún 'me gusta' en los últimos 5 minutos. Todo tranquilo."
|
||||
done: Hecho
|
||||
edit_comment:
|
||||
bodyInputLabel: "Editar este comentario"
|
||||
body_input_label: "Editar este comentario"
|
||||
save_button: "Guardar cambios"
|
||||
editWindowExpired: "No se puede editar este comentario. El periodo de edición\
|
||||
edit_window_expired: "No se puede editar este comentario. El periodo de edición\
|
||||
\ ya ha concluido. Podrías publicar uno nuevo :-)"
|
||||
editWindowExpiredClose: "Cerrar"
|
||||
editWindowTimerPrefix: "Ventana Edición:"
|
||||
edit_window_expired_close: "Cerrar"
|
||||
edit_window_timer_prefix: "Ventana Edición:"
|
||||
second: "segundo"
|
||||
secondsPlural: "segundos"
|
||||
unexpectedError: "Lo siento. Ha habido un error no previsto al guardar los cambios."
|
||||
seconds_plural: "segundos"
|
||||
unexpected_error: "Lo siento. Ha habido un error no previsto al guardar los cambios."
|
||||
embedlink:
|
||||
copy: "Copiar al portapapeles"
|
||||
error:
|
||||
comment_too_short: "Tu comentario debe tener algo escrito"
|
||||
COMMENT_TOO_SHORT: "Tu comentario debe tener algo escrito"
|
||||
NOT_AUTHORIZED: "Acción no autorizada."
|
||||
NO_SPECIAL_CHARACTERS: "Los nombres pueden contener letras números y _"
|
||||
PASSWORD_LENGTH: "Contraseña es muy corta"
|
||||
@@ -205,23 +205,25 @@ es:
|
||||
\ al o la administradora si cree que esto es un error"
|
||||
USERNAME_IN_USE: "Este nombre ya está siendo usado."
|
||||
USERNAME_REQUIRED: "Debe ingresar un nombre"
|
||||
confirm_password: "Las contraseñas no coinciden. Inténtelo nuevamente"
|
||||
edit_window_ended: "No puedes editar este comentario. El tiempo de edición ha\
|
||||
EDIT_WINDOW_ENDED: "No puedes editar este comentario. El tiempo de edición ha\
|
||||
\ expirado."
|
||||
edit_username_not_authorized: "No tiene permiso para editar el nombre de usuario."
|
||||
EDIT_USERNAME_NOT_AUTHORIZED: "No tiene permiso para editar el nombre de usuario."
|
||||
EMAIL_IN_USE: "Este correo se encuentra en uso"
|
||||
EMAIL_REQUIRED: "Se requiere un correo"
|
||||
LOGIN_MAXIMUM_EXCEEDED: "Ha realizado demasiados intentos fallidos de usar la\
|
||||
\ contraseña. Por favor espere."
|
||||
PASSWORD_REQUIRED: "Debe ingresar la contraseña"
|
||||
COMMENTING_CLOSED: "Los comentarios ya estan cerrados"
|
||||
NOT_FOUND: "Recurso no encontrado"
|
||||
INVALID_ASSET_URL: "La URL del articulo no es valida"
|
||||
email: "No es un correo válido"
|
||||
confirm_password: "Las contraseñas no coinciden. Inténtelo nuevamente"
|
||||
network_error: "Error al conectar con el servidor. Compruebe su conexión a Internet\
|
||||
\ y vuelva a intentarlo."
|
||||
email_in_use: "Este correo se encuentra en uso"
|
||||
email_not_verified: "Correo {0} no confirmado."
|
||||
email_password: "Correo y/o contraseña incorrecta."
|
||||
email_required: "Se requiere un correo"
|
||||
email_username_in_use: "Correo o nombre en uso."
|
||||
login_maximum_exceeded: "Ha realizado demasiados intentos fallidos de usar la\
|
||||
\ contraseña. Por favor espere."
|
||||
organization_name: "El nombre de la organización debe contener letras y/o números."
|
||||
password: "La contraseña debe tener por lo menos 8 caracteres"
|
||||
password_required: "Debe ingresar la contraseña"
|
||||
username: "Los nombres pueden contener letras números y _"
|
||||
flag_comment: "Reportar este comentario"
|
||||
flag_reason: "Razón por la que hacer este reporte (Opcional)"
|
||||
|
||||
Reference in New Issue
Block a user