From cf59bb213ce8f33f792a57339feb4ee4d58b4191 Mon Sep 17 00:00:00 2001 From: PepeFranco Date: Tue, 10 Oct 2017 12:55:32 -0500 Subject: [PATCH] Changed FlagButton to use getErrorMessages util for failed flagging instead of custom messages --- client/talk-plugin-flags/components/FlagButton.js | 6 ++++-- locales/en.yml | 2 -- locales/es.yml | 2 -- locales/pt_BR.yml | 2 -- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/client/talk-plugin-flags/components/FlagButton.js b/client/talk-plugin-flags/components/FlagButton.js index 592635ccb..24c50416a 100644 --- a/client/talk-plugin-flags/components/FlagButton.js +++ b/client/talk-plugin-flags/components/FlagButton.js @@ -8,6 +8,8 @@ import ClickOutside from 'coral-framework/components/ClickOutside'; import cn from 'classnames'; import styles from './styles.css'; +import {getErrorMessages} from 'coral-framework/utils'; + const name = 'talk-plugin-flags'; export default class FlagButton extends Component { @@ -99,7 +101,7 @@ export default class FlagButton extends Component { } }) .catch((err) => { - this.props.notify('error', t('error.COMMENT_FLAG_FAILED')); + this.props.notify('error', getErrorMessages(err)); console.error(err); }); } else { @@ -110,7 +112,7 @@ export default class FlagButton extends Component { } }) .catch((err) => { - this.props.notify('error', t('error.USER_FLAG_FAILED')); + this.props.notify('error', getErrorMessages(err)); console.error(err); }); } diff --git a/locales/en.yml b/locales/en.yml index c972d70d5..92119f125 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -206,8 +206,6 @@ en: NOT_FOUND: "Resource not found" ALREADY_EXISTS: "Resource already exists" INVALID_ASSET_URL: "Assert URL is invalid" - COMMENT_FLAG_FAILED: "There was an issue reporting this comment" - COMMENT_USER_FAILED: "There was an issue reporting this user" 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." diff --git a/locales/es.yml b/locales/es.yml index a424e7501..62fc94256 100644 --- a/locales/es.yml +++ b/locales/es.yml @@ -213,8 +213,6 @@ es: username: "Los nombres pueden contener letras números y _" USERNAME_IN_USE: "Este nombre ya está siendo usado." USERNAME_REQUIRED: "Debe ingresar un nombre" - COMMENT_FLAG_FAILED: "Hubo un error reportando este comentario" - COMMENT_USER_FAILED: "Hubo un error reportando este usuario" flag_comment: "Reportar este comentario" flag_reason: "Razón por la que hacer este reporte (Opcional)" flag_username: "Reportar el nombre de usuario" diff --git a/locales/pt_BR.yml b/locales/pt_BR.yml index 23e23918b..a23c1ad8c 100644 --- a/locales/pt_BR.yml +++ b/locales/pt_BR.yml @@ -215,8 +215,6 @@ pt_BR: password: "A senha deve conter pelo menos 8 caracteres" username: "Nomes de usuários podem conter números de letras e _ somente" unexpected: "Ocorreu um erro inesperado. Desculpa!" - COMMENT_FLAG_FAILED: "Houve um problema relatando o comentário" - COMMENT_USER_FAILED: "Houve um problema relatando o usuário" flag_comment: "Informe o comentário" flag_reason: "Motivo do relatório (opcional)" flag_username: "Informe o nome de usuário"