diff options
-rw-r--r-- | i18n/en.json | 610 | ||||
-rw-r--r-- | i18n/es.json | 610 | ||||
-rw-r--r-- | manualtesting/manual_testing.go | 12 | ||||
-rw-r--r-- | manualtesting/test_autolink.go | 5 | ||||
-rw-r--r-- | model/access.go | 8 | ||||
-rw-r--r-- | model/authorize.go | 16 | ||||
-rw-r--r-- | model/channel.go | 20 | ||||
-rw-r--r-- | model/channel_member.go | 12 | ||||
-rw-r--r-- | model/client.go | 14 | ||||
-rw-r--r-- | model/config.go | 44 | ||||
-rw-r--r-- | model/file_info.go | 2 | ||||
-rw-r--r-- | model/incoming_webhook.go | 12 | ||||
-rw-r--r-- | model/oauth.go | 18 | ||||
-rw-r--r-- | model/outgoing_webhook.go | 20 | ||||
-rw-r--r-- | model/post.go | 28 | ||||
-rw-r--r-- | model/preference.go | 8 | ||||
-rw-r--r-- | model/team.go | 24 | ||||
-rw-r--r-- | model/user.go | 28 | ||||
-rw-r--r-- | model/utils.go | 2 | ||||
-rw-r--r-- | store/sql_channel_store.go | 11 | ||||
-rw-r--r-- | store/sql_channel_store_test.go | 106 | ||||
-rw-r--r-- | utils/config.go | 18 | ||||
-rw-r--r-- | utils/config_test.go | 1 | ||||
-rw-r--r-- | utils/license.go | 14 | ||||
-rw-r--r-- | utils/lru.go | 2 | ||||
-rw-r--r-- | utils/mail.go | 28 | ||||
-rw-r--r-- | web/react/components/delete_post_modal.jsx | 12 | ||||
-rw-r--r-- | web/react/components/suggestion/at_mention_provider.jsx | 6 | ||||
-rw-r--r-- | web/react/components/team_signup_welcome_page.jsx | 8 |
29 files changed, 1530 insertions, 169 deletions
diff --git a/i18n/en.json b/i18n/en.json index 48f6a99a5..6a7a858e7 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -797,7 +797,7 @@ }, { "id": "api.post.update_post.permissions_details.app_error", - "translation": "Already delted id={{.PostId}}" + "translation": "Already deleted id={{.PostId}}" }, { "id": "api.post_get_post_by_id.get.app_error", @@ -1640,11 +1640,619 @@ "translation": "Inappropriate permissions to regenerate outcoming webhook token" }, { + "id": "manaultesting.get_channel_id.no_found.debug", + "translation": "Could not find channel: %v, %v possibilites searched" + }, + { + "id": "manaultesting.get_channel_id.unable.debug", + "translation": "Unable to get channels" + }, + { + "id": "manaultesting.manual_test.create.info", + "translation": "Creating user and team" + }, + { + "id": "manaultesting.manual_test.parse.app_error", + "translation": "Unable to parse URL" + }, + { + "id": "manaultesting.manual_test.setup.info", + "translation": "Setting up for manual test..." + }, + { + "id": "manaultesting.manual_test.uid.debug", + "translation": "No uid in url" + }, + { + "id": "manaultesting.test_autolink.info", + "translation": "Manual Auto Link Test" + }, + { + "id": "manaultesting.test_autolink.unable.app_error", + "translation": "Unable to get channels" + }, + { "id": "mattermost.current_version", "translation": "Current version is %v (%v/%v/%v)" }, { + "id": "model.access.is_valid.access_token.app_error", + "translation": "Invalid access token" + }, + { + "id": "model.access.is_valid.auth_code.app_error", + "translation": "Invalid auth code" + }, + { + "id": "model.access.is_valid.redirect_uri.app_error", + "translation": "Invalid redirect uri" + }, + { + "id": "model.access.is_valid.refresh_token.app_error", + "translation": "Invalid refresh token" + }, + { + "id": "model.authorize.is_valid.auth_code.app_error", + "translation": "Invalid authorization code" + }, + { + "id": "model.authorize.is_valid.client_id.app_error", + "translation": "Invalid client id" + }, + { + "id": "model.authorize.is_valid.create_at.app_error", + "translation": "Create at must be a valid time" + }, + { + "id": "model.authorize.is_valid.expires.app_error", + "translation": "Expires in must be set" + }, + { + "id": "model.authorize.is_valid.redirect_uri.app_error", + "translation": "Invalid redirect uri" + }, + { + "id": "model.authorize.is_valid.scope.app_error", + "translation": "Invalid scope" + }, + { + "id": "model.authorize.is_valid.state.app_error", + "translation": "Invalid state" + }, + { + "id": "model.authorize.is_valid.user_id.app_error", + "translation": "Invalid user id" + }, + { + "id": "model.channel.is_valid.2_or_more.app_error", + "translation": "Name must be 2 or more lowercase alphanumeric characters" + }, + { + "id": "model.channel.is_valid.create_at.app_error", + "translation": "Create at must be a valid time" + }, + { + "id": "model.channel.is_valid.creator_id.app_error", + "translation": "Invalid creator id" + }, + { + "id": "model.channel.is_valid.display_name.app_error", + "translation": "Invalid display name" + }, + { + "id": "model.channel.is_valid.header.app_error", + "translation": "Invalid header" + }, + { + "id": "model.channel.is_valid.id.app_error", + "translation": "Invalid Id" + }, + { + "id": "model.channel.is_valid.name.app_error", + "translation": "Invalid name" + }, + { + "id": "model.channel.is_valid.purpose.app_error", + "translation": "Invalid purpose" + }, + { + "id": "model.channel.is_valid.type.app_error", + "translation": "Invalid type" + }, + { + "id": "model.channel.is_valid.update_at.app_error", + "translation": "Update at must be a valid time" + }, + { + "id": "model.channel_member.is_valid.channel_id.app_error", + "translation": "Invalid channel id" + }, + { + "id": "model.channel_member.is_valid.notify_level.app_error", + "translation": "Invalid notify level" + }, + { + "id": "model.channel_member.is_valid.role.app_error", + "translation": "Invalid role" + }, + { + "id": "model.channel_member.is_valid.unread_level.app_error", + "translation": "Invalid mark unread level" + }, + { + "id": "model.channel_member.is_valid.user_id.app_error", + "translation": "Invalid user id" + }, + { + "id": "model.client.connecting.app_error", + "translation": "We encountered an error while connecting to the server" + }, + { + "id": "model.client.login.app_error", + "translation": "Authentication tokens didn't match" + }, + { + "id": "model.config.is_valid.email_reset_salt.app_error", + "translation": "Invalid password reset salt for email settings. Must be 32 chars or more." + }, + { + "id": "model.config.is_valid.email_salt.app_error", + "translation": "Invalid invite salt for email settings. Must be 32 chars or more." + }, + { + "id": "model.config.is_valid.email_security.app_error", + "translation": "Invalid connection security for email settings. Must be '', 'TLS', or 'STARTTLS'" + }, + { + "id": "model.config.is_valid.encrypt_sql.app_error", + "translation": "Invalid at rest encrypt key for SQL settings. Must be 32 chars or more." + }, + { + "id": "model.config.is_valid.file_driver.app_error", + "translation": "Invalid driver name for file settings. Must be 'local' or 'amazons3'" + }, + { + "id": "model.config.is_valid.file_preview_height.app_error", + "translation": "Invalid preview height for file settings. Must be a zero or positive number." + }, + { + "id": "model.config.is_valid.file_preview_width.app_error", + "translation": "Invalid preview width for file settings. Must be a positive number." + }, + { + "id": "model.config.is_valid.file_profile_height.app_error", + "translation": "Invalid profile height for file settings. Must be a positive number." + }, + { + "id": "model.config.is_valid.file_profile_width.app_error", + "translation": "Invalid profile width for file settings. Must be a positive number." + }, + { + "id": "model.config.is_valid.file_salt.app_error", + "translation": "Invalid public link salt for file settings. Must be 32 chars or more." + }, + { + "id": "model.config.is_valid.file_thumb_height.app_error", + "translation": "Invalid thumbnail height for file settings. Must be a positive number." + }, + { + "id": "model.config.is_valid.file_thumb_width.app_error", + "translation": "Invalid thumbnail width for file settings. Must be a positive number." + }, + { + "id": "model.config.is_valid.listen_address.app_error", + "translation": "Invalid listen address for service settings Must be set." + }, + { + "id": "model.config.is_valid.login_attempts.app_error", + "translation": "Invalid maximum login attempts for service settings. Must be a positive number." + }, + { + "id": "model.config.is_valid.max_users.app_error", + "translation": "Invalid maximum users per team for team settings. Must be a positive number." + }, + { + "id": "model.config.is_valid.rate_mem.app_error", + "translation": "Invalid memory store size for rate limit settings. Must be a positive number" + }, + { + "id": "model.config.is_valid.rate_sec.app_error", + "translation": "Invalid per sec for rate limit settings. Must be a positive number" + }, + { + "id": "model.config.is_valid.sql_data_src.app_error", + "translation": "Invalid data source for SQL settings. Must be set." + }, + { + "id": "model.config.is_valid.sql_driver.app_error", + "translation": "Invalid driver name for SQL settings. Must be 'mysql' or 'postgres'" + }, + { + "id": "model.config.is_valid.sql_idle.app_error", + "translation": "Invalid maximum idle connection for SQL settings. Must be a positive number." + }, + { + "id": "model.config.is_valid.sql_max_conn.app_error", + "translation": "Invalid maximum open connection for SQL settings. Must be a positive number." + }, + { + "id": "model.file_info.get.gif.app_error", + "translation": "Could not decode gif." + }, + { + "id": "model.incoming_hook.channel_id.app_error", + "translation": "Invalid channel id" + }, + { + "id": "model.incoming_hook.create_at.app_error", + "translation": "Create at must be a valid time" + }, + { + "id": "model.incoming_hook.id.app_error", + "translation": "Invalid Id" + }, + { + "id": "model.incoming_hook.team_id.app_error", + "translation": "Invalid team id" + }, + { + "id": "model.incoming_hook.update_at.app_error", + "translation": "Update at must be a valid time" + }, + { + "id": "model.incoming_hook.user_id.app_error", + "translation": "Invalid user id" + }, + { + "id": "model.oauth.is_valid.app_id.app_error", + "translation": "Invalid app id" + }, + { + "id": "model.oauth.is_valid.callback.app_error", + "translation": "Invalid callback urls" + }, + { + "id": "model.oauth.is_valid.client_secret.app_error", + "translation": "Invalid client secret" + }, + { + "id": "model.oauth.is_valid.create_at.app_error", + "translation": "Create at must be a valid time" + }, + { + "id": "model.oauth.is_valid.creator_id.app_error", + "translation": "Invalid creator id" + }, + { + "id": "model.oauth.is_valid.description.app_error", + "translation": "Invalid description" + }, + { + "id": "model.oauth.is_valid.homepage.app_error", + "translation": "Invalid homepage" + }, + { + "id": "model.oauth.is_valid.name.app_error", + "translation": "Invalid name" + }, + { + "id": "model.oauth.is_valid.update_at.app_error", + "translation": "Update at must be a valid time" + }, + { + "id": "model.outgoing_hook.is_valid.callback.app_error", + "translation": "Invalid callback urls" + }, + { + "id": "model.outgoing_hook.is_valid.channel_id.app_error", + "translation": "Invalid channel id" + }, + { + "id": "model.outgoing_hook.is_valid.create_at.app_error", + "translation": "Create at must be a valid time" + }, + { + "id": "model.outgoing_hook.is_valid.id.app_error", + "translation": "Invalid Id" + }, + { + "id": "model.outgoing_hook.is_valid.team_id.app_error", + "translation": "Invalid team id" + }, + { + "id": "model.outgoing_hook.is_valid.token.app_error", + "translation": "Invalid token" + }, + { + "id": "model.outgoing_hook.is_valid.update_at.app_error", + "translation": "Update at must be a valid time" + }, + { + "id": "model.outgoing_hook.is_valid.url.app_error", + "translation": "Invalid callback URLs. Each must be a valid URL and start with http:// or https://" + }, + { + "id": "model.outgoing_hook.is_valid.user_id.app_error", + "translation": "Invalid user id" + }, + { + "id": "model.outgoing_hook.is_valid.words.app_error", + "translation": "Invalid trigger words" + }, + { + "id": "model.post.is_valid.channel_id.app_error", + "translation": "Invalid channel id" + }, + { + "id": "model.post.is_valid.create_at.app_error", + "translation": "Create at must be a valid time" + }, + { + "id": "model.post.is_valid.filenames.app_error", + "translation": "Invalid filenames" + }, + { + "id": "model.post.is_valid.hashtags.app_error", + "translation": "Invalid hashtags" + }, + { + "id": "model.post.is_valid.id.app_error", + "translation": "Invalid Id" + }, + { + "id": "model.post.is_valid.msg.app_error", + "translation": "Invalid message" + }, + { + "id": "model.post.is_valid.original_id.app_error", + "translation": "Invalid original id" + }, + { + "id": "model.post.is_valid.parent_id.app_error", + "translation": "Invalid parent id" + }, + { + "id": "model.post.is_valid.props.app_error", + "translation": "Invalid props" + }, + { + "id": "model.post.is_valid.root_id.app_error", + "translation": "Invalid root id" + }, + { + "id": "model.post.is_valid.root_parent.app_error", + "translation": "Invalid root id must be set if parent id set" + }, + { + "id": "model.post.is_valid.type.app_error", + "translation": "Invalid type" + }, + { + "id": "model.post.is_valid.update_at.app_error", + "translation": "Update at must be a valid time" + }, + { + "id": "model.post.is_valid.user_id.app_error", + "translation": "Invalid user id" + }, + { + "id": "model.preference.is_valid.category.app_error", + "translation": "Invalid category" + }, + { + "id": "model.preference.is_valid.id.app_error", + "translation": "Invalid user id" + }, + { + "id": "model.preference.is_valid.name.app_error", + "translation": "Invalid name" + }, + { + "id": "model.preference.is_valid.value.app_error", + "translation": "Value is too long" + }, + { + "id": "model.team.is_valid.characters.app_error", + "translation": "Name must be 4 or more lowercase alphanumeric characters" + }, + { + "id": "model.team.is_valid.company.app_error", + "translation": "Invalid company name" + }, + { + "id": "model.team.is_valid.create_at.app_error", + "translation": "Create at must be a valid time" + }, + { + "id": "model.team.is_valid.domains.app_error", + "translation": "Invalid allowed domains" + }, + { + "id": "model.team.is_valid.email.app_error", + "translation": "Invalid email" + }, + { + "id": "model.team.is_valid.id.app_error", + "translation": "Invalid Id" + }, + { + "id": "model.team.is_valid.name.app_error", + "translation": "Invalid name" + }, + { + "id": "model.team.is_valid.reserved.app_error", + "translation": "This URL is unavailable. Please try another." + }, + { + "id": "model.team.is_valid.type.app_error", + "translation": "Invalid type" + }, + { + "id": "model.team.is_valid.update_at.app_error", + "translation": "Update at must be a valid time" + }, + { + "id": "model.team.is_valid.url.app_error", + "translation": "Invalid URL Identifier" + }, + { + "id": "model.user.is_valid.auth_data.app_error", + "translation": "Invalid auth data" + }, + { + "id": "model.user.is_valid.auth_data_pwd.app_error", + "translation": "Invalid user, password and auth data cannot both be set" + }, + { + "id": "model.user.is_valid.auth_data_type.app_error", + "translation": "Invalid user, auth data must be set with auth type" + }, + { + "id": "model.user.is_valid.create_at.app_error", + "translation": "Create at must be a valid time" + }, + { + "id": "model.user.is_valid.email.app_error", + "translation": "Invalid email" + }, + { + "id": "model.user.is_valid.first_name.app_error", + "translation": "Invalid first name" + }, + { + "id": "model.user.is_valid.id.app_error", + "translation": "Invalid user id" + }, + { + "id": "model.user.is_valid.last_name.app_error", + "translation": "Invalid last name" + }, + { + "id": "model.user.is_valid.nickname.app_error", + "translation": "Invalid nickname" + }, + { + "id": "model.user.is_valid.pwd.app_error", + "translation": "Invalid password" + }, + { + "id": "model.user.is_valid.team_id.app_error", + "translation": "Invalid team id" + }, + { + "id": "model.user.is_valid.theme.app_error", + "translation": "Invalid theme" + }, + { + "id": "model.user.is_valid.update_at.app_error", + "translation": "Update at must be a valid time" + }, + { + "id": "model.user.is_valid.username.app_error", + "translation": "Invalid username" + }, + { + "id": "model.utils.decode_json.app_error", + "translation": "could not decode" + }, + { + "id": "utils.config.load_config.decoding.panic", + "translation": "Error decoding config file={{.Filename}}, err={{.Error}}" + }, + { + "id": "utils.config.load_config.getting.panic", + "translation": "Error getting config info file={{.Filename}}, err={{.Error}}" + }, + { + "id": "utils.config.load_config.opening.panic", + "translation": "Error opening config file={{.Filename}}, err={{.Error}}" + }, + { + "id": "utils.config.load_config.validating.panic", + "translation": "Error validating config file={{.Filename}}, err={{.Error}}" + }, + { + "id": "utils.config.save_config.saving.app_error", + "translation": "An error occurred while saving the file to {{.Filename}}" + }, + { "id": "utils.i18n.loaded", "translation": "Loaded system translations for '%v' from '%v'" + }, + { + "id": "utils.iru.with_evict", + "translation": "Must provide a positive size" + }, + { + "id": "utils.license.load_license.invalid.warn", + "translation": "No valid enterprise license found" + }, + { + "id": "utils.license.load_license.open_find.warn", + "translation": "Unable to open/find license file" + }, + { + "id": "utils.license.remove_license.unable.error", + "translation": "Unable to remove license file, err=%v" + }, + { + "id": "utils.license.validate_license.decode.error", + "translation": "Encountered error decoding license, err=%v" + }, + { + "id": "utils.license.validate_license.invalid.error", + "translation": "Invalid signature, err=%v" + }, + { + "id": "utils.license.validate_license.not_long.error", + "translation": "Signed license not long enough" + }, + { + "id": "utils.license.validate_license.signing.error", + "translation": "Encountered error signing license, err=%v" + }, + { + "id": "utils.mail.connect_smtp.open.app_error", + "translation": "Failed to open connection" + }, + { + "id": "utils.mail.connect_smtp.open_tls.app_error", + "translation": "Failed to open TLS connection" + }, + { + "id": "utils.mail.new_client.auth.app_error", + "translation": "Failed to authenticate on SMTP server" + }, + { + "id": "utils.mail.new_client.open.error", + "translation": "Failed to open a connection to SMTP server %v" + }, + { + "id": "utils.mail.send_mail.close.app_error", + "translation": "Failed to close connection to SMTP server" + }, + { + "id": "utils.mail.send_mail.from_address.app_error", + "translation": "Failed to add from email address" + }, + { + "id": "utils.mail.send_mail.msg.app_error", + "translation": "Failed to write email message" + }, + { + "id": "utils.mail.send_mail.msg_data.app_error", + "translation": "Failed to add email messsage data" + }, + { + "id": "utils.mail.send_mail.sending.debug", + "translation": "sending mail to %v with subject of '%v'" + }, + { + "id": "utils.mail.send_mail.to_address.app_error", + "translation": "Failed to add to email address" + }, + { + "id": "utils.mail.test.configured.error", + "translation": "SMTP server settings do not appear to be configured properly err=%v details=%v" } ]
\ No newline at end of file diff --git a/i18n/es.json b/i18n/es.json index 48f70c89f..57dd22bc8 100644 --- a/i18n/es.json +++ b/i18n/es.json @@ -797,7 +797,7 @@ }, { "id": "api.post.update_post.permissions_details.app_error", - "translation": "Already delted id={{.PostId}}" + "translation": "Ya fué elminado el id={{.PostId}}" }, { "id": "api.post_get_post_by_id.get.app_error", @@ -1640,11 +1640,619 @@ "translation": "Permisos inapropiados para regenerar un token para el Webhook saliente" }, { + "id": "manaultesting.get_channel_id.no_found.debug", + "translation": "No pudimos encontrar el canal: %v, búsqueda realizada con estas posibilidades %v" + }, + { + "id": "manaultesting.get_channel_id.unable.debug", + "translation": "No se pudo obtener los canales" + }, + { + "id": "manaultesting.manual_test.create.info", + "translation": "Creando usuario y equipo" + }, + { + "id": "manaultesting.manual_test.parse.app_error", + "translation": "No se pudo analizar el URL" + }, + { + "id": "manaultesting.manual_test.setup.info", + "translation": "Configurando para pruebas manuales..." + }, + { + "id": "manaultesting.manual_test.uid.debug", + "translation": "No hay un uid en el url" + }, + { + "id": "manaultesting.test_autolink.info", + "translation": "Prueba Manual de Enlaces Automáticos" + }, + { + "id": "manaultesting.test_autolink.unable.app_error", + "translation": "No se pudo obtener los canales" + }, + { "id": "mattermost.current_version", "translation": "La versión actual es %v (%v/%v/%v)" }, { + "id": "model.access.is_valid.access_token.app_error", + "translation": "Token de acceso inválido" + }, + { + "id": "model.access.is_valid.auth_code.app_error", + "translation": "Código de autenticación inválido" + }, + { + "id": "model.access.is_valid.redirect_uri.app_error", + "translation": "URI de redireccionamiento inválido" + }, + { + "id": "model.access.is_valid.refresh_token.app_error", + "translation": "Token de refrescamiento inválido" + }, + { + "id": "model.authorize.is_valid.auth_code.app_error", + "translation": "Código de autorización inválido" + }, + { + "id": "model.authorize.is_valid.client_id.app_error", + "translation": "Id de cliente inválido" + }, + { + "id": "model.authorize.is_valid.create_at.app_error", + "translation": "Create debe ser un tiempo válido" + }, + { + "id": "model.authorize.is_valid.expires.app_error", + "translation": "Se debe asignar el tiempo de Expiración" + }, + { + "id": "model.authorize.is_valid.redirect_uri.app_error", + "translation": "URI de redireccionamiento inválido" + }, + { + "id": "model.authorize.is_valid.scope.app_error", + "translation": "Alcance inválido" + }, + { + "id": "model.authorize.is_valid.state.app_error", + "translation": "Estado inválido" + }, + { + "id": "model.authorize.is_valid.user_id.app_error", + "translation": "Usuario id inválido" + }, + { + "id": "model.channel.is_valid.2_or_more.app_error", + "translation": "Debe tener 2 o más caracteres alfanuméricos en minúscula" + }, + { + "id": "model.channel.is_valid.create_at.app_error", + "translation": "Create debe ser un tiempo válido" + }, + { + "id": "model.channel.is_valid.creator_id.app_error", + "translation": "Id del creador inválido" + }, + { + "id": "model.channel.is_valid.display_name.app_error", + "translation": "Nombre a mostrar inválido" + }, + { + "id": "model.channel.is_valid.header.app_error", + "translation": "Encabezado inválido" + }, + { + "id": "model.channel.is_valid.id.app_error", + "translation": "Id inválido" + }, + { + "id": "model.channel.is_valid.name.app_error", + "translation": "Nombre inválido" + }, + { + "id": "model.channel.is_valid.purpose.app_error", + "translation": "Propósito inválido" + }, + { + "id": "model.channel.is_valid.type.app_error", + "translation": "Tipo inválido" + }, + { + "id": "model.channel.is_valid.update_at.app_error", + "translation": "Update debe ser un tiempo válido" + }, + { + "id": "model.channel_member.is_valid.channel_id.app_error", + "translation": "Channel id inválido" + }, + { + "id": "model.channel_member.is_valid.notify_level.app_error", + "translation": "Nivel de notificación inválido" + }, + { + "id": "model.channel_member.is_valid.role.app_error", + "translation": "Rol inválido" + }, + { + "id": "model.channel_member.is_valid.unread_level.app_error", + "translation": "Nivel de marca para no leidos inválido" + }, + { + "id": "model.channel_member.is_valid.user_id.app_error", + "translation": "User id inválido" + }, + { + "id": "model.client.connecting.app_error", + "translation": "Encontramos un error mientras conectabamos al servidor" + }, + { + "id": "model.client.login.app_error", + "translation": "Token de autenticación no coincidió" + }, + { + "id": "model.config.is_valid.email_reset_salt.app_error", + "translation": "Salt para restablecer contraseñas en la configuración de correos es inválido. Debe ser de 32 caracteres o más." + }, + { + "id": "model.config.is_valid.email_salt.app_error", + "translation": "Salt para crear invitaciones en la configuración de correos es inválido. Debe ser de 32 caracteres o más." + }, + { + "id": "model.config.is_valid.email_security.app_error", + "translation": "Configuración inválida de seguridad en la configuración de correos. Debe ser '', 'TLS', o 'STARTTLS'" + }, + { + "id": "model.config.is_valid.encrypt_sql.app_error", + "translation": "Llave de cifrado rest para las configuraciones de SQL inválida. Debe ser de 32 caracteres o más." + }, + { + "id": "model.config.is_valid.file_driver.app_error", + "translation": "Nombre de controlador para la configuración de archivos es inválido. Debe ser 'local' o 'amazons3'" + }, + { + "id": "model.config.is_valid.file_preview_height.app_error", + "translation": "La altura para la previsualización es inválido en la configuración de archivos. Debe ser cero o un número positivo." + }, + { + "id": "model.config.is_valid.file_preview_width.app_error", + "translation": "El ancho para la previsualización es inválido en la configuración de archivos. Debe ser un número positivo." + }, + { + "id": "model.config.is_valid.file_profile_height.app_error", + "translation": "La altura para la imagen de perfil es inválido en la configuración de archivos. Debe ser un número positivo." + }, + { + "id": "model.config.is_valid.file_profile_width.app_error", + "translation": "El ancho para la imagen de perfil es inválido en la configuración de archivos. Debe ser un número positivo." + }, + { + "id": "model.config.is_valid.file_salt.app_error", + "translation": "Salt para crear enlaces públicos en la configuración a archivos es inválido. Debe ser de 32 caracteres o más." + }, + { + "id": "model.config.is_valid.file_thumb_height.app_error", + "translation": "La altura para la imagen de miniatura es inválido en la configuración de archivos. Debe ser un número positivo." + }, + { + "id": "model.config.is_valid.file_thumb_width.app_error", + "translation": "El ancho para la imagen de miniatura es inválido en la configuración de archivos. Debe ser un número positivo." + }, + { + "id": "model.config.is_valid.listen_address.app_error", + "translation": "Dirección dónde se escuchará el servicio en la configuracón del servicio debe ser asignada." + }, + { + "id": "model.config.is_valid.login_attempts.app_error", + "translation": "Número inválido de máximos intentos de inició de sesión en la configuración del servicio. Debe ser un número positivo." + }, + { + "id": "model.config.is_valid.max_users.app_error", + "translation": "Número inválido del máximo de usuarios por equipo en la configuración de equipo. Debe ser un número positivo." + }, + { + "id": "model.config.is_valid.rate_mem.app_error", + "translation": "Tamaño del almacen de memoria inválido en la configuración de límites de velocidad. Debe ser un número positivo." + }, + { + "id": "model.config.is_valid.rate_sec.app_error", + "translation": "Por segundo es inválido en la configuración de límites de velocidad. Debe ser un número positivo." + }, + { + "id": "model.config.is_valid.sql_data_src.app_error", + "translation": "Fuente de datos no válido para la configuración de SQL. Debe ser asignado." + }, + { + "id": "model.config.is_valid.sql_driver.app_error", + "translation": "Nombre del controlador no válido para la configuración de SQL. Debe ser 'mysql' o 'postgres'" + }, + { + "id": "model.config.is_valid.sql_idle.app_error", + "translation": "Inválido máxima de conexión inactiva para la configuración de SQL. Debe ser un número positivo." + }, + { + "id": "model.config.is_valid.sql_max_conn.app_error", + "translation": "Inválida cantidad de conexiones abiertas para la configuración de SQL. Debe ser un número positivo." + }, + { + "id": "model.file_info.get.gif.app_error", + "translation": "No se pudo decodificar el gif." + }, + { + "id": "model.incoming_hook.channel_id.app_error", + "translation": "Channel id inválido" + }, + { + "id": "model.incoming_hook.create_at.app_error", + "translation": "Create debe ser un tiempo válido" + }, + { + "id": "model.incoming_hook.id.app_error", + "translation": "Id inválido" + }, + { + "id": "model.incoming_hook.team_id.app_error", + "translation": "Id del Equipo inválido" + }, + { + "id": "model.incoming_hook.update_at.app_error", + "translation": "Update debe ser un tiempo válido" + }, + { + "id": "model.incoming_hook.user_id.app_error", + "translation": "Id del Usuario inválido" + }, + { + "id": "model.oauth.is_valid.app_id.app_error", + "translation": "Id de la App inválido" + }, + { + "id": "model.oauth.is_valid.callback.app_error", + "translation": "Callback urls inválido" + }, + { + "id": "model.oauth.is_valid.client_secret.app_error", + "translation": "Llave secreta del Cliente no es válida" + }, + { + "id": "model.oauth.is_valid.create_at.app_error", + "translation": "Create debe ser un tiempo válido" + }, + { + "id": "model.oauth.is_valid.creator_id.app_error", + "translation": "Id del credor no es válido" + }, + { + "id": "model.oauth.is_valid.description.app_error", + "translation": "Descripción inválida" + }, + { + "id": "model.oauth.is_valid.homepage.app_error", + "translation": "Página principal inválida" + }, + { + "id": "model.oauth.is_valid.name.app_error", + "translation": "Nombre inválido" + }, + { + "id": "model.oauth.is_valid.update_at.app_error", + "translation": "Update debe ser un tiempo válido" + }, + { + "id": "model.outgoing_hook.is_valid.callback.app_error", + "translation": "Callback urls inválido" + }, + { + "id": "model.outgoing_hook.is_valid.channel_id.app_error", + "translation": "Id del Canal inválido" + }, + { + "id": "model.outgoing_hook.is_valid.create_at.app_error", + "translation": "Create debe ser un tiempo válido" + }, + { + "id": "model.outgoing_hook.is_valid.id.app_error", + "translation": "Id inválido" + }, + { + "id": "model.outgoing_hook.is_valid.team_id.app_error", + "translation": "Id del Equipo inválido" + }, + { + "id": "model.outgoing_hook.is_valid.token.app_error", + "translation": "Token inválido" + }, + { + "id": "model.outgoing_hook.is_valid.update_at.app_error", + "translation": "Update debe ser un tiempo válido" + }, + { + "id": "model.outgoing_hook.is_valid.url.app_error", + "translation": "Callback URLs inválido. Cada uno debe ser un URL válido y que comience con http:// o https://" + }, + { + "id": "model.outgoing_hook.is_valid.user_id.app_error", + "translation": "Id del Usuario inválido" + }, + { + "id": "model.outgoing_hook.is_valid.words.app_error", + "translation": "Palabras gatilladoras inválidas" + }, + { + "id": "model.post.is_valid.channel_id.app_error", + "translation": "Id del Canal inválido" + }, + { + "id": "model.post.is_valid.create_at.app_error", + "translation": "Create debe ser un tiempo válido" + }, + { + "id": "model.post.is_valid.filenames.app_error", + "translation": "Nombre de archivos no válidos" + }, + { + "id": "model.post.is_valid.hashtags.app_error", + "translation": "Hashtags inválidos" + }, + { + "id": "model.post.is_valid.id.app_error", + "translation": "Id inválido" + }, + { + "id": "model.post.is_valid.msg.app_error", + "translation": "Mensaje no es válido" + }, + { + "id": "model.post.is_valid.original_id.app_error", + "translation": "Id Original inválido" + }, + { + "id": "model.post.is_valid.parent_id.app_error", + "translation": "Id del padre no es válido" + }, + { + "id": "model.post.is_valid.props.app_error", + "translation": "Props inválidos" + }, + { + "id": "model.post.is_valid.root_id.app_error", + "translation": "Id de la raíz no es válido" + }, + { + "id": "model.post.is_valid.root_parent.app_error", + "translation": "Id de la raíz no es válido, debe ser asignado si el Id del padre fue asignado" + }, + { + "id": "model.post.is_valid.type.app_error", + "translation": "Tipo inválido" + }, + { + "id": "model.post.is_valid.update_at.app_error", + "translation": "Update debe ser un tiempo válido" + }, + { + "id": "model.post.is_valid.user_id.app_error", + "translation": "Id del Usuario inválido" + }, + { + "id": "model.preference.is_valid.category.app_error", + "translation": "Categoría inválida" + }, + { + "id": "model.preference.is_valid.id.app_error", + "translation": "Id del Usuario inválido" + }, + { + "id": "model.preference.is_valid.name.app_error", + "translation": "Nombre inválido" + }, + { + "id": "model.preference.is_valid.value.app_error", + "translation": "El valor es muy largo" + }, + { + "id": "model.team.is_valid.characters.app_error", + "translation": "Nombre tiene que ser de 4 o más caracteres alfanuméricos en minúsculas" + }, + { + "id": "model.team.is_valid.company.app_error", + "translation": "Inválido nombre de la empresa" + }, + { + "id": "model.team.is_valid.create_at.app_error", + "translation": "Create debe ser un tiempo válido" + }, + { + "id": "model.team.is_valid.domains.app_error", + "translation": "Dominios permitidos no válidos" + }, + { + "id": "model.team.is_valid.email.app_error", + "translation": "Correo electrónico inválido" + }, + { + "id": "model.team.is_valid.id.app_error", + "translation": "Id inválido" + }, + { + "id": "model.team.is_valid.name.app_error", + "translation": "Nombre inválido" + }, + { + "id": "model.team.is_valid.reserved.app_error", + "translation": "Este URL no está disponible. Por favor, prueba con otro." + }, + { + "id": "model.team.is_valid.type.app_error", + "translation": "Tipo inválido" + }, + { + "id": "model.team.is_valid.update_at.app_error", + "translation": "Update debe ser un tiempo válido" + }, + { + "id": "model.team.is_valid.url.app_error", + "translation": "Identificador del URL es inválido" + }, + { + "id": "model.user.is_valid.auth_data.app_error", + "translation": "Data de auth es inválida" + }, + { + "id": "model.user.is_valid.auth_data_pwd.app_error", + "translation": "Usuario inválido, no pueden ser asignados auth data y la contraseña al mismo tiempo" + }, + { + "id": "model.user.is_valid.auth_data_type.app_error", + "translation": "Usuario inválido, auth data debe ser asignado con un tipo de auth" + }, + { + "id": "model.user.is_valid.create_at.app_error", + "translation": "Create debe ser un tiempo válido" + }, + { + "id": "model.user.is_valid.email.app_error", + "translation": "Correo electrónico inválido" + }, + { + "id": "model.user.is_valid.first_name.app_error", + "translation": "Nombre inválido" + }, + { + "id": "model.user.is_valid.id.app_error", + "translation": "Id del Usuario inválido" + }, + { + "id": "model.user.is_valid.last_name.app_error", + "translation": "Apellido no es válido" + }, + { + "id": "model.user.is_valid.nickname.app_error", + "translation": "Sobrenombre no es válido" + }, + { + "id": "model.user.is_valid.pwd.app_error", + "translation": "Contraseña inválida" + }, + { + "id": "model.user.is_valid.team_id.app_error", + "translation": "Id del Equipo inválido" + }, + { + "id": "model.user.is_valid.theme.app_error", + "translation": "Tema inválido" + }, + { + "id": "model.user.is_valid.update_at.app_error", + "translation": "Update debe ser un tiempo válido" + }, + { + "id": "model.user.is_valid.username.app_error", + "translation": "Nombre de usuario inválido" + }, + { + "id": "model.utils.decode_json.app_error", + "translation": "no se puede decodificar" + }, + { + "id": "utils.config.load_config.decoding.panic", + "translation": "Error decifrando la configuración del archivo={{.Filename}}, err={{.Error}}" + }, + { + "id": "utils.config.load_config.getting.panic", + "translation": "Error obteniendo la iformación de configuración del archivo={{.Filename}}, err={{.Error}}" + }, + { + "id": "utils.config.load_config.opening.panic", + "translation": "Error abriendo la configuración del archivo={{.Filename}}, err={{.Error}}" + }, + { + "id": "utils.config.load_config.validating.panic", + "translation": "Error validando la configuración del archivo={{.Filename}}, err={{.Error}}" + }, + { + "id": "utils.config.save_config.saving.app_error", + "translation": "Ocurrió un error mientras se guardaba el archivo en {{.Filename}}" + }, + { "id": "utils.i18n.loaded", "translation": "Cargada traducciones del sistema para '%v' desde '%v'" + }, + { + "id": "utils.iru.with_evict", + "translation": "Debe proporcionar un tamaño positivo" + }, + { + "id": "utils.license.load_license.invalid.warn", + "translation": "No se encontró una licencia enterprise válida" + }, + { + "id": "utils.license.load_license.open_find.warn", + "translation": "No pudimos encontrar/abrir el achivo de licencia" + }, + { + "id": "utils.license.remove_license.unable.error", + "translation": "No se pudo remover el archivo de la licencia, err=%v" + }, + { + "id": "utils.license.validate_license.decode.error", + "translation": "Encontramos un error decodificando la licencia, err=%v" + }, + { + "id": "utils.license.validate_license.invalid.error", + "translation": "Firma inválida, err=%v" + }, + { + "id": "utils.license.validate_license.not_long.error", + "translation": "La licencia firmada no es suficientemente larga" + }, + { + "id": "utils.license.validate_license.signing.error", + "translation": "Encontramos un error al firmar la licencia, err=%v" + }, + { + "id": "utils.mail.connect_smtp.open.app_error", + "translation": "Falla al abrir conexión" + }, + { + "id": "utils.mail.connect_smtp.open_tls.app_error", + "translation": "Falla al abrir una conexión TLS" + }, + { + "id": "utils.mail.new_client.auth.app_error", + "translation": "Falla autenticando contra el servidor SMTP" + }, + { + "id": "utils.mail.new_client.open.error", + "translation": "Falla al abrir la conexión al servidor SMTP %v" + }, + { + "id": "utils.mail.send_mail.close.app_error", + "translation": "Falla al cerrar la conexión al servidor SMTP" + }, + { + "id": "utils.mail.send_mail.from_address.app_error", + "translation": "Falla al agregar el correo electrónico desde" + }, + { + "id": "utils.mail.send_mail.msg.app_error", + "translation": "Falla al escribir el mensaje del correo electrónico" + }, + { + "id": "utils.mail.send_mail.msg_data.app_error", + "translation": "Falla al agregar la data al mensaje del correo electrónico" + }, + { + "id": "utils.mail.send_mail.sending.debug", + "translation": "enviano correo electrónico a %v con el asunto '%v'" + }, + { + "id": "utils.mail.send_mail.to_address.app_error", + "translation": "Falla al agregar el correo electrónico para" + }, + { + "id": "utils.mail.test.configured.error", + "translation": "El servidor SMTP parece no estar configurado apropiadamente err=%v details=%v" } ]
\ No newline at end of file diff --git a/manualtesting/manual_testing.go b/manualtesting/manual_testing.go index befc835fb..2f1096fd5 100644 --- a/manualtesting/manual_testing.go +++ b/manualtesting/manual_testing.go @@ -32,12 +32,12 @@ func InitManualTesting() { func manualTest(c *api.Context, w http.ResponseWriter, r *http.Request) { // Let the world know - l4g.Info("Setting up for manual test...") + l4g.Info(utils.T("manaultesting.manual_test.setup.info")) // URL Parameters params, err := url.ParseQuery(r.URL.RawQuery) if err != nil { - c.Err = model.NewAppError("/manual", "Unable to parse URL", "") + c.Err = model.NewLocAppError("/manual", "manaultesting.manual_test.parse.app_error", nil, "") return } @@ -49,7 +49,7 @@ func manualTest(c *api.Context, w http.ResponseWriter, r *http.Request) { hash := hasher.Sum32() rand.Seed(int64(hash)) } else { - l4g.Debug("No uid in url") + l4g.Debug(utils.T("manaultesting.manual_test.uid.debug")) } // Create a client for tests to use @@ -61,7 +61,7 @@ func manualTest(c *api.Context, w http.ResponseWriter, r *http.Request) { var teamID string var userID string if ok1 && ok2 { - l4g.Info("Creating user and team") + l4g.Info(utils.T("manaultesting.manual_test.create.info")) // Create team for testing team := &model.Team{ DisplayName: teamDisplayName[0], @@ -153,7 +153,7 @@ func getChannelID(channelname string, teamid string, userid string) (id string, // Grab all the channels result := <-api.Srv.Store.Channel().GetChannels(teamid, userid) if result.Err != nil { - l4g.Debug("Unable to get channels") + l4g.Debug(utils.T("manaultesting.get_channel_id.unable.debug")) return "", false } @@ -164,6 +164,6 @@ func getChannelID(channelname string, teamid string, userid string) (id string, return channel.Id, true } } - l4g.Debug("Could not find channel: " + channelname + ", " + strconv.Itoa(len(data.Channels)) + " possibilites searched") + l4g.Debug(utils.T("manaultesting.get_channel_id.no_found.debug"), channelname, strconv.Itoa(len(data.Channels))) return "", false } diff --git a/manualtesting/test_autolink.go b/manualtesting/test_autolink.go index 16d2d713a..f9f213da1 100644 --- a/manualtesting/test_autolink.go +++ b/manualtesting/test_autolink.go @@ -6,6 +6,7 @@ package manualtesting import ( l4g "github.com/alecthomas/log4go" "github.com/mattermost/platform/model" + "github.com/mattermost/platform/utils" ) const LINK_POST_TEXT = ` @@ -20,10 +21,10 @@ https://medium.com/@slackhq/11-useful-tips-for-getting-the-most-of-slack-5dfb3d1 ` func testAutoLink(env TestEnvironment) *model.AppError { - l4g.Info("Manual Auto Link Test") + l4g.Info(utils.T("manaultesting.test_autolink.info")) channelID, err := getChannelID(model.DEFAULT_CHANNEL, env.CreatedTeamId, env.CreatedUserId) if err != true { - return model.NewAppError("/manualtest", "Unable to get channels", "") + return model.NewLocAppError("/manualtest", "manaultesting.test_autolink.unable.app_error", nil, "") } post := &model.Post{ diff --git a/model/access.go b/model/access.go index 6c9254004..877b3c4f0 100644 --- a/model/access.go +++ b/model/access.go @@ -34,19 +34,19 @@ type AccessResponse struct { func (ad *AccessData) IsValid() *AppError { if len(ad.AuthCode) == 0 || len(ad.AuthCode) > 128 { - return NewAppError("AccessData.IsValid", "Invalid auth code", "") + return NewLocAppError("AccessData.IsValid", "model.access.is_valid.auth_code.app_error", nil, "") } if len(ad.Token) != 26 { - return NewAppError("AccessData.IsValid", "Invalid access token", "") + return NewLocAppError("AccessData.IsValid", "model.access.is_valid.access_token.app_error", nil, "") } if len(ad.RefreshToken) > 26 { - return NewAppError("AccessData.IsValid", "Invalid refresh token", "") + return NewLocAppError("AccessData.IsValid", "model.access.is_valid.refresh_token.app_error", nil, "") } if len(ad.RedirectUri) > 256 { - return NewAppError("AccessData.IsValid", "Invalid redirect uri", "") + return NewLocAppError("AccessData.IsValid", "model.access.is_valid.redirect_uri.app_error", nil, "") } return nil diff --git a/model/authorize.go b/model/authorize.go index 4176a9b89..e0d665bae 100644 --- a/model/authorize.go +++ b/model/authorize.go @@ -29,35 +29,35 @@ type AuthData struct { func (ad *AuthData) IsValid() *AppError { if len(ad.ClientId) != 26 { - return NewAppError("AuthData.IsValid", "Invalid client id", "") + return NewLocAppError("AuthData.IsValid", "model.authorize.is_valid.client_id.app_error", nil, "") } if len(ad.UserId) != 26 { - return NewAppError("AuthData.IsValid", "Invalid user id", "") + return NewLocAppError("AuthData.IsValid", "model.authorize.is_valid.user_id.app_error", nil, "") } if len(ad.Code) == 0 || len(ad.Code) > 128 { - return NewAppError("AuthData.IsValid", "Invalid authorization code", "client_id="+ad.ClientId) + return NewLocAppError("AuthData.IsValid", "model.authorize.is_valid.auth_code.app_error", nil, "client_id="+ad.ClientId) } if ad.ExpiresIn == 0 { - return NewAppError("AuthData.IsValid", "Expires in must be set", "") + return NewLocAppError("AuthData.IsValid", "model.authorize.is_valid.expires.app_error", nil, "") } if ad.CreateAt <= 0 { - return NewAppError("AuthData.IsValid", "Create at must be a valid time", "client_id="+ad.ClientId) + return NewLocAppError("AuthData.IsValid", "model.authorize.is_valid.create_at.app_error", nil, "client_id="+ad.ClientId) } if len(ad.RedirectUri) > 256 { - return NewAppError("AuthData.IsValid", "Invalid redirect uri", "client_id="+ad.ClientId) + return NewLocAppError("AuthData.IsValid", "model.authorize.is_valid.redirect_uri.app_error", nil, "client_id="+ad.ClientId) } if len(ad.State) > 128 { - return NewAppError("AuthData.IsValid", "Invalid state", "client_id="+ad.ClientId) + return NewLocAppError("AuthData.IsValid", "model.authorize.is_valid.state.app_error", nil, "client_id="+ad.ClientId) } if len(ad.Scope) > 128 { - return NewAppError("AuthData.IsValid", "Invalid scope", "client_id="+ad.ClientId) + return NewLocAppError("AuthData.IsValid", "model.authorize.is_valid.scope.app_error", nil, "client_id="+ad.ClientId) } return nil diff --git a/model/channel.go b/model/channel.go index 7109500d4..e7002e3cb 100644 --- a/model/channel.go +++ b/model/channel.go @@ -64,43 +64,43 @@ func (o *Channel) ExtraEtag(memberLimit int) string { func (o *Channel) IsValid() *AppError { if len(o.Id) != 26 { - return NewAppError("Channel.IsValid", "Invalid Id", "") + return NewLocAppError("Channel.IsValid", "model.channel.is_valid.id.app_error", nil, "") } if o.CreateAt == 0 { - return NewAppError("Channel.IsValid", "Create at must be a valid time", "id="+o.Id) + return NewLocAppError("Channel.IsValid", "model.channel.is_valid.create_at.app_error", nil, "id="+o.Id) } if o.UpdateAt == 0 { - return NewAppError("Channel.IsValid", "Update at must be a valid time", "id="+o.Id) + return NewLocAppError("Channel.IsValid", "model.channel.is_valid.update_at.app_error", nil, "id="+o.Id) } if utf8.RuneCountInString(o.DisplayName) > 64 { - return NewAppError("Channel.IsValid", "Invalid display name", "id="+o.Id) + return NewLocAppError("Channel.IsValid", "model.channel.is_valid.display_name.app_error", nil, "id="+o.Id) } if len(o.Name) > 64 { - return NewAppError("Channel.IsValid", "Invalid name", "id="+o.Id) + return NewLocAppError("Channel.IsValid", "model.channel.is_valid.name.app_error", nil, "id="+o.Id) } if !IsValidChannelIdentifier(o.Name) { - return NewAppError("Channel.IsValid", "Name must be 2 or more lowercase alphanumeric characters", "id="+o.Id) + return NewLocAppError("Channel.IsValid", "model.channel.is_valid.2_or_more.app_error", nil, "id="+o.Id) } if !(o.Type == CHANNEL_OPEN || o.Type == CHANNEL_PRIVATE || o.Type == CHANNEL_DIRECT) { - return NewAppError("Channel.IsValid", "Invalid type", "id="+o.Id) + return NewLocAppError("Channel.IsValid", "model.channel.is_valid.type.app_error", nil, "id="+o.Id) } if utf8.RuneCountInString(o.Header) > 1024 { - return NewAppError("Channel.IsValid", "Invalid header", "id="+o.Id) + return NewLocAppError("Channel.IsValid", "model.channel.is_valid.header.app_error", nil, "id="+o.Id) } if utf8.RuneCountInString(o.Purpose) > 128 { - return NewAppError("Channel.IsValid", "Invalid purpose", "id="+o.Id) + return NewLocAppError("Channel.IsValid", "model.channel.is_valid.purpose.app_error", nil, "id="+o.Id) } if len(o.CreatorId) > 26 { - return NewAppError("Channel.IsValid", "Invalid creator id", "") + return NewLocAppError("Channel.IsValid", "model.channel.is_valid.creator_id.app_error", nil, "") } return nil diff --git a/model/channel_member.go b/model/channel_member.go index e822ba443..66e20da64 100644 --- a/model/channel_member.go +++ b/model/channel_member.go @@ -53,27 +53,29 @@ func ChannelMemberFromJson(data io.Reader) *ChannelMember { func (o *ChannelMember) IsValid() *AppError { if len(o.ChannelId) != 26 { - return NewAppError("ChannelMember.IsValid", "Invalid channel id", "") + return NewLocAppError("ChannelMember.IsValid", "model.channel_member.is_valid.channel_id.app_error", nil, "") } if len(o.UserId) != 26 { - return NewAppError("ChannelMember.IsValid", "Invalid user id", "") + return NewLocAppError("ChannelMember.IsValid", "model.channel_member.is_valid.user_id.app_error", nil, "") } for _, role := range strings.Split(o.Roles, " ") { if !(role == "" || role == CHANNEL_ROLE_ADMIN) { - return NewAppError("ChannelMember.IsValid", "Invalid role", "role="+role) + return NewLocAppError("ChannelMember.IsValid", "model.channel_member.is_valid.role.app_error", nil, "role="+role) } } notifyLevel := o.NotifyProps["desktop"] if len(notifyLevel) > 20 || !IsChannelNotifyLevelValid(notifyLevel) { - return NewAppError("ChannelMember.IsValid", "Invalid notify level", "notify_level="+notifyLevel) + return NewLocAppError("ChannelMember.IsValid", "model.channel_member.is_valid.notify_level.app_error", + nil, "notify_level="+notifyLevel) } markUnreadLevel := o.NotifyProps["mark_unread"] if len(markUnreadLevel) > 20 || !IsChannelMarkUnreadLevelValid(markUnreadLevel) { - return NewAppError("ChannelMember.IsValid", "Invalid mark unread level", "mark_unread_level="+markUnreadLevel) + return NewLocAppError("ChannelMember.IsValid", "model.channel_member.is_valid.unread_level.app_error", + nil, "mark_unread_level="+markUnreadLevel) } return nil diff --git a/model/client.go b/model/client.go index b8e7c4894..8021c7039 100644 --- a/model/client.go +++ b/model/client.go @@ -56,7 +56,7 @@ func (c *Client) DoPost(url, data, contentType string) (*http.Response, *AppErro rq.Header.Set("Content-Type", contentType) if rp, err := c.HttpClient.Do(rq); err != nil { - return nil, NewAppError(url, "We encountered an error while connecting to the server", err.Error()) + return nil, NewLocAppError(url, "model.client.connecting.app_error", nil, err.Error()) } else if rp.StatusCode >= 300 { return nil, AppErrorFromJson(rp.Body) } else { @@ -72,7 +72,7 @@ func (c *Client) DoApiPost(url string, data string) (*http.Response, *AppError) } if rp, err := c.HttpClient.Do(rq); err != nil { - return nil, NewAppError(url, "We encountered an error while connecting to the server", err.Error()) + return nil, NewLocAppError(url, "model.client.connecting.app_error", nil, err.Error()) } else if rp.StatusCode >= 300 { return nil, AppErrorFromJson(rp.Body) } else { @@ -92,7 +92,7 @@ func (c *Client) DoApiGet(url string, data string, etag string) (*http.Response, } if rp, err := c.HttpClient.Do(rq); err != nil { - return nil, NewAppError(url, "We encountered an error while connecting to the server", err.Error()) + return nil, NewLocAppError(url, "model.client.connecting.app_error", nil, err.Error()) } else if rp.StatusCode == 304 { return rp, nil } else if rp.StatusCode >= 300 { @@ -298,7 +298,7 @@ func (c *Client) login(m map[string]string) (*Result, *AppError) { sessionToken := getCookie(SESSION_COOKIE_TOKEN, r) if c.AuthToken != sessionToken.Value { - NewAppError("/users/login", "Authentication tokens didn't match", "") + NewLocAppError("/users/login", "model.client.login.app_error", nil, "") } return &Result{r.Header.Get(HEADER_REQUEST_ID), @@ -699,7 +699,7 @@ func (c *Client) UploadFile(url string, data []byte, contentType string) (*Resul } if rp, err := c.HttpClient.Do(rq); err != nil { - return nil, NewAppError(url, "We encountered an error while connecting to the server", err.Error()) + return nil, NewLocAppError(url, "model.client.connecting.app_error", nil, err.Error()) } else if rp.StatusCode >= 300 { return nil, AppErrorFromJson(rp.Body) } else { @@ -721,7 +721,7 @@ func (c *Client) GetFile(url string, isFullUrl bool) (*Result, *AppError) { } if rp, err := c.HttpClient.Do(rq); err != nil { - return nil, NewAppError(url, "We encountered an error while connecting to the server", err.Error()) + return nil, NewLocAppError(url, "model.client.connecting.app_error", nil, err.Error()) } else if rp.StatusCode >= 300 { return nil, AppErrorFromJson(rp.Body) } else { @@ -739,7 +739,7 @@ func (c *Client) GetFileInfo(url string) (*Result, *AppError) { } if rp, err := c.HttpClient.Do(rq); err != nil { - return nil, NewAppError(url, "We encountered an error while connecting to the server", err.Error()) + return nil, NewLocAppError(url, "model.client.connecting.app_error", nil, err.Error()) } else if rp.StatusCode >= 300 { return nil, AppErrorFromJson(rp.Body) } else { diff --git a/model/config.go b/model/config.go index 640eb49e5..5c8604ff1 100644 --- a/model/config.go +++ b/model/config.go @@ -345,87 +345,87 @@ func (o *Config) SetDefaults() { func (o *Config) IsValid() *AppError { if o.ServiceSettings.MaximumLoginAttempts <= 0 { - return NewAppError("Config.IsValid", "Invalid maximum login attempts for service settings. Must be a positive number.", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.login_attempts.app_error", nil, "") } if len(o.ServiceSettings.ListenAddress) == 0 { - return NewAppError("Config.IsValid", "Invalid listen address for service settings Must be set.", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.listen_address.app_error", nil, "") } if o.TeamSettings.MaxUsersPerTeam <= 0 { - return NewAppError("Config.IsValid", "Invalid maximum users per team for team settings. Must be a positive number.", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.max_users.app_error", nil, "") } if len(o.SqlSettings.AtRestEncryptKey) < 32 { - return NewAppError("Config.IsValid", "Invalid at rest encrypt key for SQL settings. Must be 32 chars or more.", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.encrypt_sql.app_error", nil, "") } if !(o.SqlSettings.DriverName == DATABASE_DRIVER_MYSQL || o.SqlSettings.DriverName == DATABASE_DRIVER_POSTGRES) { - return NewAppError("Config.IsValid", "Invalid driver name for SQL settings. Must be 'mysql' or 'postgres'", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.sql_driver.app_error", nil, "") } if o.SqlSettings.MaxIdleConns <= 0 { - return NewAppError("Config.IsValid", "Invalid maximum idle connection for SQL settings. Must be a positive number.", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.sql_idle.app_error", nil, "") } if len(o.SqlSettings.DataSource) == 0 { - return NewAppError("Config.IsValid", "Invalid data source for SQL settings. Must be set.", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.sql_data_src.app_error", nil, "") } if o.SqlSettings.MaxOpenConns <= 0 { - return NewAppError("Config.IsValid", "Invalid maximum open connection for SQL settings. Must be a positive number.", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.sql_max_conn.app_error", nil, "") } if !(o.FileSettings.DriverName == IMAGE_DRIVER_LOCAL || o.FileSettings.DriverName == IMAGE_DRIVER_S3) { - return NewAppError("Config.IsValid", "Invalid driver name for file settings. Must be 'local' or 'amazons3'", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.file_driver.app_error", nil, "") } if o.FileSettings.PreviewHeight < 0 { - return NewAppError("Config.IsValid", "Invalid preview height for file settings. Must be a zero or positive number.", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.file_preview_height.app_error", nil, "") } if o.FileSettings.PreviewWidth <= 0 { - return NewAppError("Config.IsValid", "Invalid preview width for file settings. Must be a positive number.", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.file_preview_width.app_error", nil, "") } if o.FileSettings.ProfileHeight <= 0 { - return NewAppError("Config.IsValid", "Invalid profile height for file settings. Must be a positive number.", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.file_profile_height.app_error", nil, "") } if o.FileSettings.ProfileWidth <= 0 { - return NewAppError("Config.IsValid", "Invalid profile width for file settings. Must be a positive number.", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.file_profile_width.app_error", nil, "") } if o.FileSettings.ThumbnailHeight <= 0 { - return NewAppError("Config.IsValid", "Invalid thumbnail height for file settings. Must be a positive number.", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.file_thumb_height.app_error", nil, "") } - if o.FileSettings.ThumbnailHeight <= 0 { - return NewAppError("Config.IsValid", "Invalid thumbnail width for file settings. Must be a positive number.", "") + if o.FileSettings.ThumbnailWidth <= 0 { + return NewLocAppError("Config.IsValid", "model.config.is_valid.file_thumb_width.app_error", nil, "") } if len(o.FileSettings.PublicLinkSalt) < 32 { - return NewAppError("Config.IsValid", "Invalid public link salt for file settings. Must be 32 chars or more.", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.file_salt.app_error", nil, "") } if !(o.EmailSettings.ConnectionSecurity == CONN_SECURITY_NONE || o.EmailSettings.ConnectionSecurity == CONN_SECURITY_TLS || o.EmailSettings.ConnectionSecurity == CONN_SECURITY_STARTTLS) { - return NewAppError("Config.IsValid", "Invalid connection security for email settings. Must be '', 'TLS', or 'STARTTLS'", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.email_security.app_error", nil, "") } if len(o.EmailSettings.InviteSalt) < 32 { - return NewAppError("Config.IsValid", "Invalid invite salt for email settings. Must be 32 chars or more.", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.email_salt.app_error", nil, "") } if len(o.EmailSettings.PasswordResetSalt) < 32 { - return NewAppError("Config.IsValid", "Invalid password reset salt for email settings. Must be 32 chars or more.", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.email_reset_salt.app_error", nil, "") } if o.RateLimitSettings.MemoryStoreSize <= 0 { - return NewAppError("Config.IsValid", "Invalid memory store size for rate limit settings. Must be a positive number", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.rate_mem.app_error", nil, "") } if o.RateLimitSettings.PerSec <= 0 { - return NewAppError("Config.IsValid", "Invalid per sec for rate limit settings. Must be a positive number", "") + return NewLocAppError("Config.IsValid", "model.config.is_valid.rate_sec.app_error", nil, "") } return nil diff --git a/model/file_info.go b/model/file_info.go index 741b4e55d..131baff6d 100644 --- a/model/file_info.go +++ b/model/file_info.go @@ -36,7 +36,7 @@ func GetInfoForBytes(filename string, data []byte) (*FileInfo, *AppError) { if mimeType == "image/gif" { // just show the gif itself instead of a preview image for animated gifs if gifImage, err := gif.DecodeAll(bytes.NewReader(data)); err != nil { - return nil, NewAppError("GetInfoForBytes", "Could not decode gif.", "filename="+filename) + return nil, NewLocAppError("GetInfoForBytes", "model.file_info.get.gif.app_error", nil, "filename="+filename) } else { hasPreviewImage = len(gifImage.Image) == 1 } diff --git a/model/incoming_webhook.go b/model/incoming_webhook.go index 8ead0da9f..8432f5fea 100644 --- a/model/incoming_webhook.go +++ b/model/incoming_webhook.go @@ -76,27 +76,27 @@ func IncomingWebhookListFromJson(data io.Reader) []*IncomingWebhook { func (o *IncomingWebhook) IsValid() *AppError { if len(o.Id) != 26 { - return NewAppError("IncomingWebhook.IsValid", "Invalid Id", "") + return NewLocAppError("IncomingWebhook.IsValid", "model.incoming_hook.id.app_error", nil, "") } if o.CreateAt == 0 { - return NewAppError("IncomingWebhook.IsValid", "Create at must be a valid time", "id="+o.Id) + return NewLocAppError("IncomingWebhook.IsValid", "model.incoming_hook.create_at.app_error", nil, "id="+o.Id) } if o.UpdateAt == 0 { - return NewAppError("IncomingWebhook.IsValid", "Update at must be a valid time", "id="+o.Id) + return NewLocAppError("IncomingWebhook.IsValid", "model.incoming_hook.update_at.app_error", nil, "id="+o.Id) } if len(o.UserId) != 26 { - return NewAppError("IncomingWebhook.IsValid", "Invalid user id", "") + return NewLocAppError("IncomingWebhook.IsValid", "model.incoming_hook.user_id.app_error", nil, "") } if len(o.ChannelId) != 26 { - return NewAppError("IncomingWebhook.IsValid", "Invalid channel id", "") + return NewLocAppError("IncomingWebhook.IsValid", "model.incoming_hook.channel_id.app_error", nil, "") } if len(o.TeamId) != 26 { - return NewAppError("IncomingWebhook.IsValid", "Invalid channel id", "") + return NewLocAppError("IncomingWebhook.IsValid", "model.incoming_hook.team_id.app_error", nil, "") } return nil diff --git a/model/oauth.go b/model/oauth.go index 8336e26ba..c54df107c 100644 --- a/model/oauth.go +++ b/model/oauth.go @@ -34,39 +34,39 @@ type OAuthApp struct { func (a *OAuthApp) IsValid() *AppError { if len(a.Id) != 26 { - return NewAppError("OAuthApp.IsValid", "Invalid app id", "") + return NewLocAppError("OAuthApp.IsValid", "model.oauth.is_valid.app_id.app_error", nil, "") } if a.CreateAt == 0 { - return NewAppError("OAuthApp.IsValid", "Create at must be a valid time", "app_id="+a.Id) + return NewLocAppError("OAuthApp.IsValid", "model.oauth.is_valid.create_at.app_error", nil, "app_id="+a.Id) } if a.UpdateAt == 0 { - return NewAppError("OAuthApp.IsValid", "Update at must be a valid time", "app_id="+a.Id) + return NewLocAppError("OAuthApp.IsValid", "model.oauth.is_valid.update_at.app_error", nil, "app_id="+a.Id) } if len(a.CreatorId) != 26 { - return NewAppError("OAuthApp.IsValid", "Invalid creator id", "app_id="+a.Id) + return NewLocAppError("OAuthApp.IsValid", "model.oauth.is_valid.creator_id.app_error", nil, "app_id="+a.Id) } if len(a.ClientSecret) == 0 || len(a.ClientSecret) > 128 { - return NewAppError("OAuthApp.IsValid", "Invalid client secret", "app_id="+a.Id) + return NewLocAppError("OAuthApp.IsValid", "model.oauth.is_valid.client_secret.app_error", nil, "app_id="+a.Id) } if len(a.Name) == 0 || len(a.Name) > 64 { - return NewAppError("OAuthApp.IsValid", "Invalid name", "app_id="+a.Id) + return NewLocAppError("OAuthApp.IsValid", "model.oauth.is_valid.name.app_error", nil, "app_id="+a.Id) } if len(a.CallbackUrls) == 0 || len(fmt.Sprintf("%s", a.CallbackUrls)) > 1024 { - return NewAppError("OAuthApp.IsValid", "Invalid callback urls", "app_id="+a.Id) + return NewLocAppError("OAuthApp.IsValid", "model.oauth.is_valid.callback.app_error", nil, "app_id="+a.Id) } if len(a.Homepage) == 0 || len(a.Homepage) > 256 { - return NewAppError("OAuthApp.IsValid", "Invalid homepage", "app_id="+a.Id) + return NewLocAppError("OAuthApp.IsValid", "model.oauth.is_valid.homepage.app_error", nil, "app_id="+a.Id) } if utf8.RuneCountInString(a.Description) > 512 { - return NewAppError("OAuthApp.IsValid", "Invalid description", "app_id="+a.Id) + return NewLocAppError("OAuthApp.IsValid", "model.oauth.is_valid.description.app_error", nil, "app_id="+a.Id) } return nil diff --git a/model/outgoing_webhook.go b/model/outgoing_webhook.go index 0b4fd6bbe..70de4d26e 100644 --- a/model/outgoing_webhook.go +++ b/model/outgoing_webhook.go @@ -65,44 +65,44 @@ func OutgoingWebhookListFromJson(data io.Reader) []*OutgoingWebhook { func (o *OutgoingWebhook) IsValid() *AppError { if len(o.Id) != 26 { - return NewAppError("OutgoingWebhook.IsValid", "Invalid Id", "") + return NewLocAppError("OutgoingWebhook.IsValid", "model.outgoing_hook.is_valid.id.app_error", nil, "") } if len(o.Token) != 26 { - return NewAppError("OutgoingWebhook.IsValid", "Invalid token", "") + return NewLocAppError("OutgoingWebhook.IsValid", "model.outgoing_hook.is_valid.token.app_error", nil, "") } if o.CreateAt == 0 { - return NewAppError("OutgoingWebhook.IsValid", "Create at must be a valid time", "id="+o.Id) + return NewLocAppError("OutgoingWebhook.IsValid", "model.outgoing_hook.is_valid.create_at.app_error", nil, "id="+o.Id) } if o.UpdateAt == 0 { - return NewAppError("OutgoingWebhook.IsValid", "Update at must be a valid time", "id="+o.Id) + return NewLocAppError("OutgoingWebhook.IsValid", "model.outgoing_hook.is_valid.update_at.app_error", nil, "id="+o.Id) } if len(o.CreatorId) != 26 { - return NewAppError("OutgoingWebhook.IsValid", "Invalid user id", "") + return NewLocAppError("OutgoingWebhook.IsValid", "model.outgoing_hook.is_valid.user_id.app_error", nil, "") } if len(o.ChannelId) != 0 && len(o.ChannelId) != 26 { - return NewAppError("OutgoingWebhook.IsValid", "Invalid channel id", "") + return NewLocAppError("OutgoingWebhook.IsValid", "model.outgoing_hook.is_valid.channel_id.app_error", nil, "") } if len(o.TeamId) != 26 { - return NewAppError("OutgoingWebhook.IsValid", "Invalid team id", "") + return NewLocAppError("OutgoingWebhook.IsValid", "model.outgoing_hook.is_valid.team_id.app_error", nil, "") } if len(fmt.Sprintf("%s", o.TriggerWords)) > 1024 { - return NewAppError("OutgoingWebhook.IsValid", "Invalid trigger words", "") + return NewLocAppError("OutgoingWebhook.IsValid", "model.outgoing_hook.is_valid.words.app_error", nil, "") } if len(o.CallbackURLs) == 0 || len(fmt.Sprintf("%s", o.CallbackURLs)) > 1024 { - return NewAppError("OutgoingWebhook.IsValid", "Invalid callback urls", "") + return NewLocAppError("OutgoingWebhook.IsValid", "model.outgoing_hook.is_valid.callback.app_error", nil, "") } for _, callback := range o.CallbackURLs { if !IsValidHttpUrl(callback) { - return NewAppError("OutgoingWebhook.IsValid", "Invalid callback URLs. Each must be a valid URL and start with http:// or https://", "") + return NewLocAppError("OutgoingWebhook.IsValid", "model.outgoing_hook.is_valid.url.app_error", nil, "") } } diff --git a/model/post.go b/model/post.go index 5c86ce70d..f9f5a4d1c 100644 --- a/model/post.go +++ b/model/post.go @@ -62,60 +62,60 @@ func (o *Post) Etag() string { func (o *Post) IsValid() *AppError { if len(o.Id) != 26 { - return NewAppError("Post.IsValid", "Invalid Id", "") + return NewLocAppError("Post.IsValid", "model.post.is_valid.id.app_error", nil, "") } if o.CreateAt == 0 { - return NewAppError("Post.IsValid", "Create at must be a valid time", "id="+o.Id) + return NewLocAppError("Post.IsValid", "model.post.is_valid.create_at.app_error", nil, "id="+o.Id) } if o.UpdateAt == 0 { - return NewAppError("Post.IsValid", "Update at must be a valid time", "id="+o.Id) + return NewLocAppError("Post.IsValid", "model.post.is_valid.update_at.app_error", nil, "id="+o.Id) } if len(o.UserId) != 26 { - return NewAppError("Post.IsValid", "Invalid user id", "") + return NewLocAppError("Post.IsValid", "model.post.is_valid.user_id.app_error", nil, "") } if len(o.ChannelId) != 26 { - return NewAppError("Post.IsValid", "Invalid channel id", "") + return NewLocAppError("Post.IsValid", "model.post.is_valid.channel_id.app_error", nil, "") } if !(len(o.RootId) == 26 || len(o.RootId) == 0) { - return NewAppError("Post.IsValid", "Invalid root id", "") + return NewLocAppError("Post.IsValid", "model.post.is_valid.root_id.app_error", nil, "") } if !(len(o.ParentId) == 26 || len(o.ParentId) == 0) { - return NewAppError("Post.IsValid", "Invalid parent id", "") + return NewLocAppError("Post.IsValid", "model.post.is_valid.parent_id.app_error", nil, "") } if len(o.ParentId) == 26 && len(o.RootId) == 0 { - return NewAppError("Post.IsValid", "Invalid root id must be set if parent id set", "") + return NewLocAppError("Post.IsValid", "model.post.is_valid.root_parent.app_error", nil, "") } if !(len(o.OriginalId) == 26 || len(o.OriginalId) == 0) { - return NewAppError("Post.IsValid", "Invalid original id", "") + return NewLocAppError("Post.IsValid", "model.post.is_valid.original_id.app_error", nil, "") } if utf8.RuneCountInString(o.Message) > 4000 { - return NewAppError("Post.IsValid", "Invalid message", "id="+o.Id) + return NewLocAppError("Post.IsValid", "model.post.is_valid.msg.app_error", nil, "id="+o.Id) } if utf8.RuneCountInString(o.Hashtags) > 1000 { - return NewAppError("Post.IsValid", "Invalid hashtags", "id="+o.Id) + return NewLocAppError("Post.IsValid", "model.post.is_valid.hashtags.app_error", nil, "id="+o.Id) } // should be removed once more message types are supported if !(o.Type == POST_DEFAULT || o.Type == POST_JOIN_LEAVE || o.Type == POST_SLACK_ATTACHMENT || o.Type == POST_HEADER_CHANGE) { - return NewAppError("Post.IsValid", "Invalid type", "id="+o.Type) + return NewLocAppError("Post.IsValid", "model.post.is_valid.type.app_error", nil, "id="+o.Type) } if utf8.RuneCountInString(ArrayToJson(o.Filenames)) > 4000 { - return NewAppError("Post.IsValid", "Invalid filenames", "id="+o.Id) + return NewLocAppError("Post.IsValid", "model.post.is_valid.filenames.app_error", nil, "id="+o.Id) } if utf8.RuneCountInString(StringInterfaceToJson(o.Props)) > 8000 { - return NewAppError("Post.IsValid", "Invalid props", "id="+o.Id) + return NewLocAppError("Post.IsValid", "model.post.is_valid.props.app_error", nil, "id="+o.Id) } return nil diff --git a/model/preference.go b/model/preference.go index e3ad23ed4..b2ec93105 100644 --- a/model/preference.go +++ b/model/preference.go @@ -47,19 +47,19 @@ func PreferenceFromJson(data io.Reader) *Preference { func (o *Preference) IsValid() *AppError { if len(o.UserId) != 26 { - return NewAppError("Preference.IsValid", "Invalid user id", "user_id="+o.UserId) + return NewLocAppError("Preference.IsValid", "model.preference.is_valid.id.app_error", nil, "user_id="+o.UserId) } if len(o.Category) == 0 || len(o.Category) > 32 { - return NewAppError("Preference.IsValid", "Invalid category", "category="+o.Category) + return NewLocAppError("Preference.IsValid", "model.preference.is_valid.category.app_error", nil, "category="+o.Category) } if len(o.Name) == 0 || len(o.Name) > 32 { - return NewAppError("Preference.IsValid", "Invalid name", "name="+o.Name) + return NewLocAppError("Preference.IsValid", "model.preference.is_valid.name.app_error", nil, "name="+o.Name) } if utf8.RuneCountInString(o.Value) > 128 { - return NewAppError("Preference.IsValid", "Value is too long", "value="+o.Value) + return NewLocAppError("Preference.IsValid", "model.preference.is_valid.value.app_error", nil, "value="+o.Value) } return nil diff --git a/model/team.go b/model/team.go index e7dde4766..9e9eaa25f 100644 --- a/model/team.go +++ b/model/team.go @@ -104,51 +104,51 @@ func (o *Team) Etag() string { func (o *Team) IsValid(restrictTeamNames bool) *AppError { if len(o.Id) != 26 { - return NewAppError("Team.IsValid", "Invalid Id", "") + return NewLocAppError("Team.IsValid", "model.team.is_valid.id.app_error", nil, "") } if o.CreateAt == 0 { - return NewAppError("Team.IsValid", "Create at must be a valid time", "id="+o.Id) + return NewLocAppError("Team.IsValid", "model.team.is_valid.create_at.app_error", nil, "id="+o.Id) } if o.UpdateAt == 0 { - return NewAppError("Team.IsValid", "Update at must be a valid time", "id="+o.Id) + return NewLocAppError("Team.IsValid", "model.team.is_valid.update_at.app_error", nil, "id="+o.Id) } if len(o.Email) > 128 { - return NewAppError("Team.IsValid", "Invalid email", "id="+o.Id) + return NewLocAppError("Team.IsValid", "model.team.is_valid.email.app_error", nil, "id="+o.Id) } if len(o.Email) > 0 && !IsValidEmail(o.Email) { - return NewAppError("Team.IsValid", "Invalid email", "id="+o.Id) + return NewLocAppError("Team.IsValid", "model.team.is_valid.email.app_error", nil, "id="+o.Id) } if utf8.RuneCountInString(o.DisplayName) == 0 || utf8.RuneCountInString(o.DisplayName) > 64 { - return NewAppError("Team.IsValid", "Invalid name", "id="+o.Id) + return NewLocAppError("Team.IsValid", "model.team.is_valid.name.app_error", nil, "id="+o.Id) } if len(o.Name) > 64 { - return NewAppError("Team.IsValid", "Invalid URL Identifier", "id="+o.Id) + return NewLocAppError("Team.IsValid", "model.team.is_valid.url.app_error", nil, "id="+o.Id) } if restrictTeamNames && IsReservedTeamName(o.Name) { - return NewAppError("Team.IsValid", "This URL is unavailable. Please try another.", "id="+o.Id) + return NewLocAppError("Team.IsValid", "model.team.is_valid.reserved.app_error", nil, "id="+o.Id) } if !IsValidTeamName(o.Name) { - return NewAppError("Team.IsValid", "Name must be 4 or more lowercase alphanumeric characters", "id="+o.Id) + return NewLocAppError("Team.IsValid", "model.team.is_valid.characters.app_error", nil, "id="+o.Id) } if !(o.Type == TEAM_OPEN || o.Type == TEAM_INVITE) { - return NewAppError("Team.IsValid", "Invalid type", "id="+o.Id) + return NewLocAppError("Team.IsValid", "model.team.is_valid.type.app_error", nil, "id="+o.Id) } if len(o.CompanyName) > 64 { - return NewAppError("Team.IsValid", "Invalid company name", "id="+o.Id) + return NewLocAppError("Team.IsValid", "model.team.is_valid.company.app_error", nil, "id="+o.Id) } if len(o.AllowedDomains) > 500 { - return NewAppError("Team.IsValid", "Invalid allowed domains", "id="+o.Id) + return NewLocAppError("Team.IsValid", "model.team.is_valid.domains.app_error", nil, "id="+o.Id) } return nil diff --git a/model/user.go b/model/user.go index 44228d93f..675a1ded6 100644 --- a/model/user.go +++ b/model/user.go @@ -61,59 +61,59 @@ type User struct { func (u *User) IsValid() *AppError { if len(u.Id) != 26 { - return NewAppError("User.IsValid", "Invalid user id", "") + return NewLocAppError("User.IsValid", "model.user.is_valid.id.app_error", nil, "") } if u.CreateAt == 0 { - return NewAppError("User.IsValid", "Create at must be a valid time", "user_id="+u.Id) + return NewLocAppError("User.IsValid", "model.user.is_valid.create_at.app_error", nil, "user_id="+u.Id) } if u.UpdateAt == 0 { - return NewAppError("User.IsValid", "Update at must be a valid time", "user_id="+u.Id) + return NewLocAppError("User.IsValid", "model.user.is_valid.update_at.app_error", nil, "user_id="+u.Id) } if len(u.TeamId) != 26 { - return NewAppError("User.IsValid", "Invalid team id", "") + return NewLocAppError("User.IsValid", "model.user.is_valid.team_id.app_error", nil, "") } if !IsValidUsername(u.Username) { - return NewAppError("User.IsValid", "Invalid username", "user_id="+u.Id) + return NewLocAppError("User.IsValid", "model.user.is_valid.username.app_error", nil, "user_id="+u.Id) } if len(u.Email) > 128 || len(u.Email) == 0 { - return NewAppError("User.IsValid", "Invalid email", "user_id="+u.Id) + return NewLocAppError("User.IsValid", "model.user.is_valid.email.app_error", nil, "user_id="+u.Id) } if utf8.RuneCountInString(u.Nickname) > 64 { - return NewAppError("User.IsValid", "Invalid nickname", "user_id="+u.Id) + return NewLocAppError("User.IsValid", "model.user.is_valid.nickname.app_error", nil, "user_id="+u.Id) } if utf8.RuneCountInString(u.FirstName) > 64 { - return NewAppError("User.IsValid", "Invalid first name", "user_id="+u.Id) + return NewLocAppError("User.IsValid", "model.user.is_valid.first_name.app_error", nil, "user_id="+u.Id) } if utf8.RuneCountInString(u.LastName) > 64 { - return NewAppError("User.IsValid", "Invalid last name", "user_id="+u.Id) + return NewLocAppError("User.IsValid", "model.user.is_valid.last_name.app_error", nil, "user_id="+u.Id) } if len(u.Password) > 128 { - return NewAppError("User.IsValid", "Invalid password", "user_id="+u.Id) + return NewLocAppError("User.IsValid", "model.user.is_valid.pwd.app_error", nil, "user_id="+u.Id) } if len(u.AuthData) > 128 { - return NewAppError("User.IsValid", "Invalid auth data", "user_id="+u.Id) + return NewLocAppError("User.IsValid", "model.user.is_valid.auth_data.app_error", nil, "user_id="+u.Id) } if len(u.AuthData) > 0 && len(u.AuthService) == 0 { - return NewAppError("User.IsValid", "Invalid user, auth data must be set with auth type", "user_id="+u.Id) + return NewLocAppError("User.IsValid", "model.user.is_valid.auth_data_type.app_error", nil, "user_id="+u.Id) } if len(u.Password) > 0 && len(u.AuthData) > 0 { - return NewAppError("User.IsValid", "Invalid user, password and auth data cannot both be set", "user_id="+u.Id) + return NewLocAppError("User.IsValid", "model.user.is_valid.auth_data_pwd.app_error", nil, "user_id="+u.Id) } if len(u.ThemeProps) > 2000 { - return NewAppError("User.IsValid", "Invalid theme", "user_id="+u.Id) + return NewLocAppError("User.IsValid", "model.user.is_valid.theme.app_error", nil, "user_id="+u.Id) } return nil diff --git a/model/utils.go b/model/utils.go index a18ca760e..70b7e3bbd 100644 --- a/model/utils.go +++ b/model/utils.go @@ -67,7 +67,7 @@ func AppErrorFromJson(data io.Reader) *AppError { if err == nil { return &er } else { - return NewAppError("AppErrorFromJson", "could not decode", err.Error()) + return NewLocAppError("AppErrorFromJson", "model.utils.decode_json.app_error", nil, err.Error()) } } diff --git a/store/sql_channel_store.go b/store/sql_channel_store.go index 336398ae7..7400df8d2 100644 --- a/store/sql_channel_store.go +++ b/store/sql_channel_store.go @@ -582,7 +582,16 @@ func (s SqlChannelStore) GetMemberCount(channelId string) StoreChannel { go func() { result := StoreResult{} - count, err := s.GetReplica().SelectInt("SELECT count(*) FROM ChannelMembers WHERE ChannelId = :ChannelId", map[string]interface{}{"ChannelId": channelId}) + count, err := s.GetReplica().SelectInt(` + SELECT + count(*) + FROM + ChannelMembers, + Users + WHERE + ChannelMembers.UserId = Users.Id + AND ChannelMembers.ChannelId = :ChannelId + AND Users.DeleteAt = 0`, map[string]interface{}{"ChannelId": channelId}) if err != nil { result.Err = model.NewAppError("SqlChannelStore.GetMemberCount", "We couldn't get the channel member count", "channel_id="+channelId+", "+err.Error()) } else { diff --git a/store/sql_channel_store_test.go b/store/sql_channel_store_test.go index 8b22fbb7a..a3b0c2286 100644 --- a/store/sql_channel_store_test.go +++ b/store/sql_channel_store_test.go @@ -750,3 +750,109 @@ func TestChannelStoreIncrementMentionCount(t *testing.T) { t.Fatal("failed to update") } } + +func TestGetMemberCount(t *testing.T) { + Setup() + + teamId := model.NewId() + + c1 := model.Channel{ + TeamId: teamId, + DisplayName: "Channel1", + Name: "a" + model.NewId() + "b", + Type: model.CHANNEL_OPEN, + } + Must(store.Channel().Save(&c1)) + + c2 := model.Channel{ + TeamId: teamId, + DisplayName: "Channel2", + Name: "a" + model.NewId() + "b", + Type: model.CHANNEL_OPEN, + } + Must(store.Channel().Save(&c2)) + + t.Logf("c1.Id = %v", c1.Id) + + u1 := model.User{ + TeamId: teamId, + Email: model.NewId(), + DeleteAt: 0, + } + Must(store.User().Save(&u1)) + + m1 := model.ChannelMember{ + ChannelId: c1.Id, + UserId: u1.Id, + NotifyProps: model.GetDefaultChannelNotifyProps(), + } + Must(store.Channel().SaveMember(&m1)) + + if result := <-store.Channel().GetMemberCount(c1.Id); result.Err != nil { + t.Fatal("failed to get member count: %v", result.Err) + } else if result.Data.(int64) != 1 { + t.Fatal("got incorrect member count %v", result.Data) + } + + u2 := model.User{ + TeamId: teamId, + Email: model.NewId(), + DeleteAt: 0, + } + Must(store.User().Save(&u2)) + + m2 := model.ChannelMember{ + ChannelId: c1.Id, + UserId: u2.Id, + NotifyProps: model.GetDefaultChannelNotifyProps(), + } + Must(store.Channel().SaveMember(&m2)) + + if result := <-store.Channel().GetMemberCount(c1.Id); result.Err != nil { + t.Fatal("failed to get member count: %v", result.Err) + } else if result.Data.(int64) != 2 { + t.Fatal("got incorrect member count %v", result.Data) + } + + // make sure members of other channels aren't counted + u3 := model.User{ + TeamId: teamId, + Email: model.NewId(), + DeleteAt: 0, + } + Must(store.User().Save(&u3)) + + m3 := model.ChannelMember{ + ChannelId: c2.Id, + UserId: u3.Id, + NotifyProps: model.GetDefaultChannelNotifyProps(), + } + Must(store.Channel().SaveMember(&m3)) + + if result := <-store.Channel().GetMemberCount(c1.Id); result.Err != nil { + t.Fatal("failed to get member count: %v", result.Err) + } else if result.Data.(int64) != 2 { + t.Fatal("got incorrect member count %v", result.Data) + } + + // make sure inactive users aren't counted + u4 := model.User{ + TeamId: teamId, + Email: model.NewId(), + DeleteAt: 10000, + } + Must(store.User().Save(&u4)) + + m4 := model.ChannelMember{ + ChannelId: c1.Id, + UserId: u4.Id, + NotifyProps: model.GetDefaultChannelNotifyProps(), + } + Must(store.Channel().SaveMember(&m4)) + + if result := <-store.Channel().GetMemberCount(c1.Id); result.Err != nil { + t.Fatal("failed to get member count: %v", result.Err) + } else if result.Data.(int64) != 2 { + t.Fatal("got incorrect member count %v", result.Data) + } +} diff --git a/utils/config.go b/utils/config.go index c2ae1f7a0..9d2c2f588 100644 --- a/utils/config.go +++ b/utils/config.go @@ -118,12 +118,14 @@ func GetLogFileLocation(fileLocation string) string { func SaveConfig(fileName string, config *model.Config) *model.AppError { b, err := json.MarshalIndent(config, "", " ") if err != nil { - return model.NewAppError("SaveConfig", "An error occurred while saving the file to "+fileName, err.Error()) + return model.NewLocAppError("SaveConfig", "utils.config.save_config.saving.app_error", + map[string]interface{}{"Filename": fileName}, err.Error()) } err = ioutil.WriteFile(fileName, b, 0644) if err != nil { - return model.NewAppError("SaveConfig", "An error occurred while saving the file to "+fileName, err.Error()) + return model.NewLocAppError("SaveConfig", "utils.config.save_config.saving.app_error", + map[string]interface{}{"Filename": fileName}, err.Error()) } return nil @@ -138,18 +140,21 @@ func LoadConfig(fileName string) { file, err := os.Open(fileName) if err != nil { - panic("Error opening config file=" + fileName + ", err=" + err.Error()) + panic(T("utils.config.load_config.opening.panic", + map[string]interface{}{"Filename": fileName, "Error": err.Error()})) } decoder := json.NewDecoder(file) config := model.Config{} err = decoder.Decode(&config) if err != nil { - panic("Error decoding config file=" + fileName + ", err=" + err.Error()) + panic(T("utils.config.load_config.decoding.panic", + map[string]interface{}{"Filename": fileName, "Error": err.Error()})) } if info, err := file.Stat(); err != nil { - panic("Error getting config info file=" + fileName + ", err=" + err.Error()) + panic(T("utils.config.load_config.getting.panic", + map[string]interface{}{"Filename": fileName, "Error": err.Error()})) } else { CfgLastModified = info.ModTime().Unix() CfgFileName = fileName @@ -158,7 +163,8 @@ func LoadConfig(fileName string) { config.SetDefaults() if err := config.IsValid(); err != nil { - panic("Error validating config file=" + fileName + ", err=" + err.Message) + panic(T("utils.config.load_config.validating.panic", + map[string]interface{}{"Filename": fileName, "Error": err.Message})) } configureLog(&config.LogSettings) diff --git a/utils/config_test.go b/utils/config_test.go index 0b334d36c..6f36b30c3 100644 --- a/utils/config_test.go +++ b/utils/config_test.go @@ -9,4 +9,5 @@ import ( func TestConfig(t *testing.T) { LoadConfig("config.json") + InitTranslations() } diff --git a/utils/license.go b/utils/license.go index 4fba94d4d..0d1cd597c 100644 --- a/utils/license.go +++ b/utils/license.go @@ -44,7 +44,7 @@ NxpC+5KFhU+xSeeklNqwCgnlOyZ7qSTxmdJHb+60SwuYnnGIYzLJhY4LYDr4J+KR func LoadLicense() { file, err := os.Open(LicenseLocation()) if err != nil { - l4g.Warn("Unable to open/find license file") + l4g.Warn(T("utils.license.load_license.open_find.warn")) return } defer file.Close() @@ -58,7 +58,7 @@ func LoadLicense() { return } - l4g.Warn("No valid enterprise license found") + l4g.Warn(T("utils.license.load_license.invalid.warn")) } func SetLicense(license *model.License) bool { @@ -84,7 +84,7 @@ func RemoveLicense() bool { ClientLicense = getClientLicense(License) if err := os.Remove(LicenseLocation()); err != nil { - l4g.Error("Unable to remove license file, err=%v", err.Error()) + l4g.Error(T("utils.license.remove_license.unable.error"), err.Error()) return false } @@ -96,12 +96,12 @@ func ValidateLicense(signed []byte) (bool, string) { _, err := base64.StdEncoding.Decode(decoded, signed) if err != nil { - l4g.Error("Encountered error decoding license, err=%v", err.Error()) + l4g.Error(T("utils.license.validate_license.decode.error"), err.Error()) return false, "" } if len(decoded) <= 256 { - l4g.Error("Signed license not long enough") + l4g.Error(T("utils.license.validate_license.not_long.error")) return false, "" } @@ -117,7 +117,7 @@ func ValidateLicense(signed []byte) (bool, string) { public, err := x509.ParsePKIXPublicKey(block.Bytes) if err != nil { - l4g.Error("Encountered error signing license, err=%v", err.Error()) + l4g.Error(T("utils.license.validate_license.signing.error"), err.Error()) return false, "" } @@ -129,7 +129,7 @@ func ValidateLicense(signed []byte) (bool, string) { err = rsa.VerifyPKCS1v15(rsaPublic, crypto.SHA512, d, signature) if err != nil { - l4g.Error("Invalid signature, err=%v", err.Error()) + l4g.Error(T("utils.license.validate_license.invalid.error"), err.Error()) return false, "" } diff --git a/utils/lru.go b/utils/lru.go index 61a515e14..f5f7959d8 100644 --- a/utils/lru.go +++ b/utils/lru.go @@ -38,7 +38,7 @@ func NewLru(size int) *Cache { func NewLruWithEvict(size int, onEvicted func(key interface{}, value interface{})) (*Cache, error) { if size <= 0 { - return nil, errors.New("Must provide a positive size") + return nil, errors.New(T("utils.iru.with_evict")) } c := &Cache{ size: size, diff --git a/utils/mail.go b/utils/mail.go index 2f2c10b61..4a0b987e6 100644 --- a/utils/mail.go +++ b/utils/mail.go @@ -34,12 +34,12 @@ func connectToSMTPServer(config *model.Config) (net.Conn, *model.AppError) { conn, err = tls.Dial("tcp", config.EmailSettings.SMTPServer+":"+config.EmailSettings.SMTPPort, tlsconfig) if err != nil { - return nil, model.NewAppError("SendMail", "Failed to open TLS connection", err.Error()) + return nil, model.NewLocAppError("SendMail", "utils.mail.connect_smtp.open_tls.app_error", nil, err.Error()) } } else { conn, err = net.Dial("tcp", config.EmailSettings.SMTPServer+":"+config.EmailSettings.SMTPPort) if err != nil { - return nil, model.NewAppError("SendMail", "Failed to open connection", err.Error()) + return nil, model.NewLocAppError("SendMail", "utils.mail.connect_smtp.open.app_error", nil, err.Error()) } } @@ -49,15 +49,15 @@ func connectToSMTPServer(config *model.Config) (net.Conn, *model.AppError) { func newSMTPClient(conn net.Conn, config *model.Config) (*smtp.Client, *model.AppError) { c, err := smtp.NewClient(conn, config.EmailSettings.SMTPServer+":"+config.EmailSettings.SMTPPort) if err != nil { - l4g.Error("Failed to open a connection to SMTP server %v", err) - return nil, model.NewAppError("SendMail", "Failed to open TLS connection", err.Error()) + l4g.Error(T("utils.mail.new_client.open.error"), err) + return nil, model.NewLocAppError("SendMail", "utils.mail.connect_smtp.open_tls.app_error", nil, err.Error()) } // GO does not support plain auth over a non encrypted connection. // so if not tls then no auth auth := smtp.PlainAuth("", config.EmailSettings.SMTPUsername, config.EmailSettings.SMTPPassword, config.EmailSettings.SMTPServer+":"+config.EmailSettings.SMTPPort) if config.EmailSettings.ConnectionSecurity == model.CONN_SECURITY_TLS { if err = c.Auth(auth); err != nil { - return nil, model.NewAppError("SendMail", "Failed to authenticate on SMTP server", err.Error()) + return nil, model.NewLocAppError("SendMail", "utils.mail.new_client.auth.app_error", nil, err.Error()) } } else if config.EmailSettings.ConnectionSecurity == model.CONN_SECURITY_STARTTLS { tlsconfig := &tls.Config{ @@ -66,7 +66,7 @@ func newSMTPClient(conn net.Conn, config *model.Config) (*smtp.Client, *model.Ap } c.StartTLS(tlsconfig) if err = c.Auth(auth); err != nil { - return nil, model.NewAppError("SendMail", "Failed to authenticate on SMTP server", err.Error()) + return nil, model.NewLocAppError("SendMail", "utils.mail.new_client.auth.app_error", nil, err.Error()) } } return c, nil @@ -79,14 +79,14 @@ func TestConnection(config *model.Config) { conn, err1 := connectToSMTPServer(config) if err1 != nil { - l4g.Error("SMTP server settings do not appear to be configured properly err=%v details=%v", err1.Message, err1.DetailedError) + l4g.Error(T("utils.mail.test.configured.error"), err1.Message, err1.DetailedError) return } defer conn.Close() c, err2 := newSMTPClient(conn, config) if err2 != nil { - l4g.Error("SMTP connection settings do not appear to be configured properly err=%v details=%v", err2.Message, err2.DetailedError) + l4g.Error(T("utils.mail.test.configured.error"), err2.Message, err2.DetailedError) return } defer c.Quit() @@ -102,7 +102,7 @@ func SendMailUsingConfig(to, subject, body string, config *model.Config) *model. return nil } - l4g.Debug("sending mail to " + to + " with subject of '" + subject + "'") + l4g.Debug(T("utils.mail.send_mail.sending.debug"), to, subject) fromMail := mail.Address{config.EmailSettings.FeedbackName, config.EmailSettings.FeedbackEmail} toMail := mail.Address{"", to} @@ -136,26 +136,26 @@ func SendMailUsingConfig(to, subject, body string, config *model.Config) *model. defer c.Close() if err := c.Mail(fromMail.Address); err != nil { - return model.NewAppError("SendMail", "Failed to add from email address", err.Error()) + return model.NewLocAppError("SendMail", "utils.mail.send_mail.from_address.app_error", nil, err.Error()) } if err := c.Rcpt(toMail.Address); err != nil { - return model.NewAppError("SendMail", "Failed to add to email address", err.Error()) + return model.NewLocAppError("SendMail", "utils.mail.send_mail.to_address.app_error", nil, err.Error()) } w, err := c.Data() if err != nil { - return model.NewAppError("SendMail", "Failed to add email messsage data", err.Error()) + return model.NewLocAppError("SendMail", "utils.mail.send_mail.msg_data.app_error", nil, err.Error()) } _, err = w.Write([]byte(message)) if err != nil { - return model.NewAppError("SendMail", "Failed to write email message", err.Error()) + return model.NewLocAppError("SendMail", "utils.mail.send_mail.msg.app_error", nil, err.Error()) } err = w.Close() if err != nil { - return model.NewAppError("SendMail", "Failed to close connection to SMTP server", err.Error()) + return model.NewLocAppError("SendMail", "utils.mail.send_mail.close.app_error", nil, err.Error()) } return nil diff --git a/web/react/components/delete_post_modal.jsx b/web/react/components/delete_post_modal.jsx index 827654e1b..4cde5feed 100644 --- a/web/react/components/delete_post_modal.jsx +++ b/web/react/components/delete_post_modal.jsx @@ -23,7 +23,7 @@ export default class DeletePostModal extends React.Component { this.selectedList = null; this.state = { - show: true, + show: false, post: null, commentCount: 0, error: '' @@ -40,6 +40,14 @@ export default class DeletePostModal extends React.Component { ModalStore.removeModalListener(ActionTypes.TOGGLE_DELETE_POST_MODAL, this.handleToggle); } + componentDidUpdate(prevProps, prevState) { + if (this.state.show && !prevState.show) { + setTimeout(() => { + $(ReactDOM.findDOMNode(this.refs.deletePostBtn)).focus(); + }, 0); + } + } + handleDelete() { Client.deletePost( this.state.post.channel_id, @@ -149,10 +157,10 @@ export default class DeletePostModal extends React.Component { {'Cancel'} </button> <button + ref='deletePostBtn' type='button' className='btn btn-danger' onClick={this.handleDelete} - autoFocus='autofocus' > {'Delete'} </button> diff --git a/web/react/components/suggestion/at_mention_provider.jsx b/web/react/components/suggestion/at_mention_provider.jsx index 8c2893448..e502c981d 100644 --- a/web/react/components/suggestion/at_mention_provider.jsx +++ b/web/react/components/suggestion/at_mention_provider.jsx @@ -5,6 +5,8 @@ import SuggestionStore from '../../stores/suggestion_store.jsx'; import UserStore from '../../stores/user_store.jsx'; import * as Utils from '../../utils/utils.jsx'; +const MaxUserSuggestions = 40; + class AtMentionSuggestion extends React.Component { render() { const {item, isSelection, onClick} = this.props; @@ -78,6 +80,10 @@ export default class AtMentionProvider { if (user.username.startsWith(usernamePrefix)) { filtered.push(user); } + + if (filtered.length >= MaxUserSuggestions) { + break; + } } // add dummy users to represent the @all and @channel special mentions diff --git a/web/react/components/team_signup_welcome_page.jsx b/web/react/components/team_signup_welcome_page.jsx index aa91a1329..a374dd363 100644 --- a/web/react/components/team_signup_welcome_page.jsx +++ b/web/react/components/team_signup_welcome_page.jsx @@ -59,7 +59,13 @@ export default class TeamSignupWelcomePage extends React.Component { } }.bind(this), function error(err) { - this.setState({serverError: err.message}); + let errorMsg = err.message; + + if (err.detailed_error.indexOf('Invalid RCPT TO address provided') >= 0) { + errorMsg = 'Please enter a valid email address'; + } + + this.setState({emailError: '', serverError: errorMsg}); }.bind(this) ); } |