From 69fbea225e4439775c9f3b8f5e5cabded0a5bf55 Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Mon, 25 Jan 2016 16:08:06 -0300 Subject: PLT-7: Refactoring stores to use translations (chunk 7) - Add spanish translations --- api/channel.go | 2 +- api/team.go | 2 +- i18n/en.json | 840 ++++++++++++++++++++++++++++++++++++++++++ i18n/es.json | 840 ++++++++++++++++++++++++++++++++++++++++++ store/sql_audit_store.go | 10 +- store/sql_channel_store.go | 90 ++--- store/sql_oauth_store.go | 36 +- store/sql_post_store.go | 44 +-- store/sql_preference_store.go | 30 +- store/sql_session_store.go | 27 +- store/sql_store.go | 108 +++--- store/sql_store_test.go | 1 + store/sql_system_store.go | 6 +- store/sql_team_store.go | 36 +- store/sql_user_store.go | 70 ++-- store/sql_webhook_store.go | 36 +- 16 files changed, 1931 insertions(+), 247 deletions(-) diff --git a/api/channel.go b/api/channel.go index de39ad1a8..a27b3c1bf 100644 --- a/api/channel.go +++ b/api/channel.go @@ -368,7 +368,7 @@ func getChannels(c *Context, w http.ResponseWriter, r *http.Request) { // user is already in the team if result := <-Srv.Store.Channel().GetChannels(c.Session.TeamId, c.Session.UserId); result.Err != nil { - if result.Err.Message == "No channels were found" { // store translation dependant + if result.Err.Id == "store.sql_channel.get_channels.not_found.app_error" { // lets make sure the user is valid if result := <-Srv.Store.User().Get(c.Session.UserId); result.Err != nil { c.Err = result.Err diff --git a/api/team.go b/api/team.go index 779a6affe..8b25e3316 100644 --- a/api/team.go +++ b/api/team.go @@ -494,7 +494,7 @@ func inviteMembers(c *Context, w http.ResponseWriter, r *http.Request) { var invNum int64 = 0 for i, invite := range invites.Invites { - if result := <-Srv.Store.User().GetByEmail(c.Session.TeamId, invite["email"]); result.Err == nil || result.Err.Message != store.MISSING_ACCOUNT_ERROR { + if result := <-Srv.Store.User().GetByEmail(c.Session.TeamId, invite["email"]); result.Err == nil || result.Err.Id != store.MISSING_ACCOUNT_ERROR { invNum = int64(i) c.Err = model.NewLocAppError("invite_members", "api.team.invite_members.already.app_error", nil, strconv.FormatInt(invNum, 10)) return diff --git a/i18n/en.json b/i18n/en.json index 6a7a858e7..9c5e77e58 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -2155,6 +2155,846 @@ "id": "model.utils.decode_json.app_error", "translation": "could not decode" }, + { + "id": "store.sql.check_index.critical", + "translation": "Failed to check index %v" + }, + { + "id": "store.sql.closing.info", + "translation": "Closing SqlStore" + }, + { + "id": "store.sql.column_exists.critical", + "translation": "Failed to check if column exists %v" + }, + { + "id": "store.sql.column_exists_missing_driver.critical", + "translation": "Failed to check if column exists because of missing driver" + }, + { + "id": "store.sql.convert_encrypt_string_map", + "translation": "FromDb: Unable to convert EncryptStringMap to *string" + }, + { + "id": "store.sql.convert_string_array", + "translation": "FromDb: Unable to convert StringArray to *string" + }, + { + "id": "store.sql.convert_string_interface", + "translation": "FromDb: Unable to convert StringInterface to *string" + }, + { + "id": "store.sql.convert_string_map", + "translation": "FromDb: Unable to convert StringMap to *string" + }, + { + "id": "store.sql.create_column.critical", + "translation": "Failed to create column %v" + }, + { + "id": "store.sql.create_column_missing_driver.critical", + "translation": "Failed to create column because of missing driver" + }, + { + "id": "store.sql.create_index.critical", + "translation": "Failed to create index %v" + }, + { + "id": "store.sql.create_index_missing_driver.critical", + "translation": "Failed to create index because of missing driver" + }, + { + "id": "store.sql.creating_tables.critical", + "translation": "Error creating database tables: %v" + }, + { + "id": "store.sql.dialect_driver.critical", + "translation": "Failed to create dialect specific driver" + }, + { + "id": "store.sql.dialect_driver.panic", + "translation": "Failed to create dialect specific driver %v" + }, + { + "id": "store.sql.drop_column.critical", + "translation": "Failed to drop column %v" + }, + { + "id": "store.sql.incorrect_mac", + "translation": "Incorrect MAC for the given ciphertext" + }, + { + "id": "store.sql.open_conn.critical", + "translation": "Failed to open sql connection to err:%v" + }, + { + "id": "store.sql.open_conn.panic", + "translation": "Failed to open sql connection %v" + }, + { + "id": "store.sql.ping.critical", + "translation": "Failed to ping db err:%v" + }, + { + "id": "store.sql.pinging.info", + "translation": "Pinging sql %v database" + }, + { + "id": "store.sql.rename_column.critical", + "translation": "Failed to rename column %v" + }, + { + "id": "store.sql.schema_out_of_date.warn", + "translation": "The database schema version of %v appears to be out of date" + }, + { + "id": "store.sql.schema_set.info", + "translation": "The database schema has been set to version %v" + }, + { + "id": "store.sql.schema_upgrade_attempt.warn", + "translation": "Attempting to upgrade the database schema version to %v" + }, + { + "id": "store.sql.schema_version.critical", + "translation": "The database schema version of %v cannot be upgraded. You must not skip a version." + }, + { + "id": "store.sql.short_ciphertext", + "translation": "short ciphertext" + }, + { + "id": "store.sql.table_column_type.critical", + "translation": "Failed to get data type for column %s from table %s: %v" + }, + { + "id": "store.sql.table_exists.critical", + "translation": "Failed to check if table exists %v" + }, + { + "id": "store.sql.too_short_ciphertext", + "translation": "ciphertext too short" + }, + { + "id": "store.sql.upgraded.warn", + "translation": "The database schema has been upgraded to version %v" + }, + { + "id": "store.sql_audit.get.finding.app_error", + "translation": "We encountered an error finding the audits" + }, + { + "id": "store.sql_audit.get.limit.app_error", + "translation": "Limit exceeded for paging" + }, + { + "id": "store.sql_audit.permanent_delete_by_user.app_error", + "translation": "We encountered an error deleting the audits" + }, + { + "id": "store.sql_audit.save.saving.app_error", + "translation": "We encountered an error saving the audit" + }, + { + "id": "store.sql_channel.analytics_type_count.app_error", + "translation": "We couldn't get channel type counts" + }, + { + "id": "store.sql_channel.check_open_channel_permissions.app_error", + "translation": "We couldn't check the permissions" + }, + { + "id": "store.sql_channel.check_permissions.app_error", + "translation": "We couldn't check the permissions" + }, + { + "id": "store.sql_channel.check_permissions_by_name.app_error", + "translation": "We couldn't check the permissions" + }, + { + "id": "store.sql_channel.delete.channel.app_error", + "translation": "We couldn't delete the channel" + }, + { + "id": "store.sql_channel.extra_updated.app_error", + "translation": "Problem updating members last updated time" + }, + { + "id": "store.sql_channel.get.existing.app_error", + "translation": "We couldn't find the existing channel" + }, + { + "id": "store.sql_channel.get.find.app_error", + "translation": "We encountered an error finding the channel" + }, + { + "id": "store.sql_channel.get_by_name.existing.app_error", + "translation": "We couldn't find the existing channel" + }, + { + "id": "store.sql_channel.get_channel_counts.get.app_error", + "translation": "We couldn't get the channel counts" + }, + { + "id": "store.sql_channel.get_channels.get.app_error", + "translation": "We couldn't get the channels" + }, + { + "id": "store.sql_channel.get_channels.not_found.app_error", + "translation": "No channels were found" + }, + { + "id": "store.sql_channel.get_extra_members.app_error", + "translation": "We couldn't get the extra info for channel members" + }, + { + "id": "store.sql_channel.get_for_export.app_error", + "translation": "We couldn't get all the channels" + }, + { + "id": "store.sql_channel.get_member.app_error", + "translation": "We couldn't get the channel member" + }, + { + "id": "store.sql_channel.get_member_count.app_error", + "translation": "We couldn't get the channel member count" + }, + { + "id": "store.sql_channel.get_members.app_error", + "translation": "We couldn't get the channel members" + }, + { + "id": "store.sql_channel.get_more_channels.get.app_error", + "translation": "We couldn't get the channels" + }, + { + "id": "store.sql_channel.increment_mention_count.app_error", + "translation": "We couldn't increment the mention count" + }, + { + "id": "store.sql_channel.permanent_delete_by_team.app_error", + "translation": "We couldn't delete the channels" + }, + { + "id": "store.sql_channel.permanent_delete_members_by_user.app_error", + "translation": "We couldn't remove the channel member" + }, + { + "id": "store.sql_channel.remove_member.app_error", + "translation": "We couldn't remove the channel member" + }, + { + "id": "store.sql_channel.save.commit_transaction.app_error", + "translation": "Unable to commit transaction" + }, + { + "id": "store.sql_channel.save.direct_channel.app_error", + "translation": "Use SaveDirectChannel to create a direct channel" + }, + { + "id": "store.sql_channel.save.open_transaction.app_error", + "translation": "Unable to open transaction" + }, + { + "id": "store.sql_channel.save_channel.current_count.app_error", + "translation": "Failed to get current channel count" + }, + { + "id": "store.sql_channel.save_channel.existing.app_error", + "translation": "Must call update for exisiting channel" + }, + { + "id": "store.sql_channel.save_channel.exists.app_error", + "translation": "A channel with that URL already exists" + }, + { + "id": "store.sql_channel.save_channel.limit.app_error", + "translation": "You've reached the limit of the number of allowed channels." + }, + { + "id": "store.sql_channel.save_channel.previously.app_error", + "translation": "A channel with that URL was previously created" + }, + { + "id": "store.sql_channel.save_channel.save.app_error", + "translation": "We couldn't save the channel" + }, + { + "id": "store.sql_channel.save_direct_channel.add_members.app_error", + "translation": "Unable to add direct channel members" + }, + { + "id": "store.sql_channel.save_direct_channel.commit.app_error", + "translation": "Unable to commit transaction" + }, + { + "id": "store.sql_channel.save_direct_channel.not_direct.app_error", + "translation": "Not a direct channel attempted to be created with SaveDirectChannel" + }, + { + "id": "store.sql_channel.save_direct_channel.open_transaction.app_error", + "translation": "Unable to open transaction" + }, + { + "id": "store.sql_channel.save_member.commit_transaction.app_error", + "translation": "Unable to commit transaction" + }, + { + "id": "store.sql_channel.save_member.exists.app_error", + "translation": "A channel member with that id already exists" + }, + { + "id": "store.sql_channel.save_member.open_transaction.app_error", + "translation": "Unable to open transaction" + }, + { + "id": "store.sql_channel.save_member.save.app_error", + "translation": "We couldn't save the channel member" + }, + { + "id": "store.sql_channel.update.app_error", + "translation": "We couldn't update the channel" + }, + { + "id": "store.sql_channel.update.exists.app_error", + "translation": "A channel with that handle already exists" + }, + { + "id": "store.sql_channel.update.previously.app_error", + "translation": "A channel with that handle was previously created" + }, + { + "id": "store.sql_channel.update.updating.app_error", + "translation": "We encountered an error updating the channel" + }, + { + "id": "store.sql_channel.update_last_viewed_at.app_error", + "translation": "We couldn't update the last viewed at time" + }, + { + "id": "store.sql_channel.update_member.app_error", + "translation": "We encountered an error updating the channel member" + }, + { + "id": "store.sql_oauth.get_access_data.app_error", + "translation": "We encountered an error finding the access token" + }, + { + "id": "store.sql_oauth.get_access_data_by_code.app_error", + "translation": "We encountered an error finding the access token" + }, + { + "id": "store.sql_oauth.get_app.find.app_error", + "translation": "We couldn't find the existing app" + }, + { + "id": "store.sql_oauth.get_app.finding.app_error", + "translation": "We encountered an error finding the app" + }, + { + "id": "store.sql_oauth.get_app_by_user.find.app_error", + "translation": "We couldn't find any existing apps" + }, + { + "id": "store.sql_oauth.get_auth_data.find.app_error", + "translation": "We couldn't find the existing authorization code" + }, + { + "id": "store.sql_oauth.get_auth_data.finding.app_error", + "translation": "We encountered an error finding the authorization code" + }, + { + "id": "store.sql_oauth.permanent_delete_auth_data_by_user.app_error", + "translation": "We couldn't remove the authorization code" + }, + { + "id": "store.sql_oauth.remove_access_data.app_error", + "translation": "We couldn't remove the access token" + }, + { + "id": "store.sql_oauth.remove_auth_data.app_error", + "translation": "We couldn't remove the authorization code" + }, + { + "id": "store.sql_oauth.save_access_data.app_error", + "translation": "We couldn't save the access token." + }, + { + "id": "store.sql_oauth.save_app.existing.app_error", + "translation": "Must call update for exisiting app" + }, + { + "id": "store.sql_oauth.save_app.save.app_error", + "translation": "We couldn't save the app." + }, + { + "id": "store.sql_oauth.save_auth_data.app_error", + "translation": "We couldn't save the authorization code." + }, + { + "id": "store.sql_oauth.update_app.find.app_error", + "translation": "We couldn't find the existing app to update" + }, + { + "id": "store.sql_oauth.update_app.finding.app_error", + "translation": "We encountered an error finding the app" + }, + { + "id": "store.sql_oauth.update_app.update.app_error", + "translation": "We couldn't update the app" + }, + { + "id": "store.sql_oauth.update_app.updating.app_error", + "translation": "We encountered an error updating the app" + }, + { + "id": "store.sql_post.analytics_posts_count.app_error", + "translation": "We couldn't get post counts" + }, + { + "id": "store.sql_post.analytics_posts_count_by_day.app_error", + "translation": "We couldn't get post counts by day" + }, + { + "id": "store.sql_post.analytics_user_counts_posts_by_day.app_error", + "translation": "We couldn't get user counts with posts" + }, + { + "id": "store.sql_post.delete.app_error", + "translation": "We couldn't delete the post" + }, + { + "id": "store.sql_post.get.app_error", + "translation": "We couldn't get the post" + }, + { + "id": "store.sql_post.get_for_export.app_error", + "translation": "We couldn't get the posts for the channel" + }, + { + "id": "store.sql_post.get_parents_posts.app_error", + "translation": "We couldn't get the parent post for the channel" + }, + { + "id": "store.sql_post.get_posts.app_error", + "translation": "Limit exceeded for paging" + }, + { + "id": "store.sql_post.get_posts_around.get.app_error", + "translation": "We couldn't get the posts for the channel" + }, + { + "id": "store.sql_post.get_posts_around.get_parent.app_error", + "translation": "We couldn't get the parent posts for the channel" + }, + { + "id": "store.sql_post.get_posts_since.app_error", + "translation": "We couldn't get the posts for the channel" + }, + { + "id": "store.sql_post.get_root_posts.app_error", + "translation": "We couldn't get the posts for the channel" + }, + { + "id": "store.sql_post.permanent_delete.app_error", + "translation": "We couldn't delete the post" + }, + { + "id": "store.sql_post.permanent_delete_all_comments_by_user.app_error", + "translation": "We couldn't delete the comments for user" + }, + { + "id": "store.sql_post.permanent_delete_by_user.app_error", + "translation": "We couldn't select the posts to delete for the user" + }, + { + "id": "store.sql_post.permanent_delete_by_user.too_many.app_error", + "translation": "We couldn't select the posts to delete for the user (too many), please re-run" + }, + { + "id": "store.sql_post.save.app_error", + "translation": "We couldn't save the Post" + }, + { + "id": "store.sql_post.save.existing.app_error", + "translation": "You cannot update an existing Post" + }, + { + "id": "store.sql_post.search.app_error", + "translation": "We encountered an error while searching for posts" + }, + { + "id": "store.sql_post.update.app_error", + "translation": "We couldn't update the Post" + }, + { + "id": "store.sql_preference.delete_unused_features.debug", + "translation": "Deleting any unused pre-release features" + }, + { + "id": "store.sql_preference.get.app_error", + "translation": "We encountered an error while finding preferences" + }, + { + "id": "store.sql_preference.get_all.app_error", + "translation": "We encountered an error while finding preferences" + }, + { + "id": "store.sql_preference.get_category.app_error", + "translation": "We encountered an error while finding preferences" + }, + { + "id": "store.sql_preference.insert.exists.app_error", + "translation": "A preference with that user id, category, and name already exists" + }, + { + "id": "store.sql_preference.insert.save.app_error", + "translation": "We couldn't save the preference" + }, + { + "id": "store.sql_preference.is_feature_enabled.app_error", + "translation": "We encountered an error while finding a pre release feature preference" + }, + { + "id": "store.sql_preference.permanent_delete_by_user.app_error", + "translation": "We encountered an error while deleteing preferences" + }, + { + "id": "store.sql_preference.save.commit_transaction.app_error", + "translation": "Unable to commit transaction to save preferences" + }, + { + "id": "store.sql_preference.save.missing_driver.app_error", + "translation": "We encountered an error while updating preferences" + }, + { + "id": "store.sql_preference.save.open_transaction.app_error", + "translation": "Unable to open transaction to save preferences" + }, + { + "id": "store.sql_preference.save.rollback_transaction.app_error", + "translation": "Unable to rollback transaction to save preferences" + }, + { + "id": "store.sql_preference.save.updating.app_error", + "translation": "We encountered an error while updating preferences" + }, + { + "id": "store.sql_preference.update.app_error", + "translation": "We couldn't update the preference" + }, + { + "id": "store.sql_session.cleanup_expired_sessions.app_error", + "translation": "We encountered an error while deleting expired user sessions" + }, + { + "id": "store.sql_session.get.app_error", + "translation": "We encountered an error finding the session" + }, + { + "id": "store.sql_session.get_sessions.app_error", + "translation": "We encountered an error while finding user sessions" + }, + { + "id": "store.sql_session.get_sessions.error", + "translation": "Failed to cleanup sessions in getSessions err=%v" + }, + { + "id": "store.sql_session.permanent_delete_sessions_by_user.app_error", + "translation": "We couldn't remove all the sessions for the user" + }, + { + "id": "store.sql_session.remove.app_error", + "translation": "We couldn't remove the session" + }, + { + "id": "store.sql_session.remove_all_sessions_for_team.app_error", + "translation": "We couldn't remove all the sessions for the team" + }, + { + "id": "store.sql_session.save.app_error", + "translation": "We couldn't save the session" + }, + { + "id": "store.sql_session.save.cleanup.error", + "translation": "Failed to cleanup sessions in Save err=%v" + }, + { + "id": "store.sql_session.save.existing.app_error", + "translation": "Cannot update existing session" + }, + { + "id": "store.sql_session.update_last_activity.app_error", + "translation": "We couldn't update the last_activity_at" + }, + { + "id": "store.sql_session.update_roles.app_error", + "translation": "We couldn't update the roles" + }, + { + "id": "store.sql_system.get.app_error", + "translation": "We encountered an error finding the system properties" + }, + { + "id": "store.sql_system.save.app_error", + "translation": "We encountered an error saving the system property" + }, + { + "id": "store.sql_system.update.app_error", + "translation": "We encountered an error updating the system property" + }, + { + "id": "store.sql_team.get.find.app_error", + "translation": "We couldn't find the existing team" + }, + { + "id": "store.sql_team.get.finding.app_error", + "translation": "We encountered an error finding the team" + }, + { + "id": "store.sql_team.get_all.app_error", + "translation": "We could not get all teams" + }, + { + "id": "store.sql_team.get_all_team_listing.app_error", + "translation": "We could not get all teams" + }, + { + "id": "store.sql_team.get_by_invite_id.find.app_error", + "translation": "We couldn't find the existing team" + }, + { + "id": "store.sql_team.get_by_invite_id.finding.app_error", + "translation": "We couldn't find the existing team" + }, + { + "id": "store.sql_team.get_by_name.app_error", + "translation": "We couldn't find the existing team" + }, + { + "id": "store.sql_team.get_teams_for_email.app_error", + "translation": "We encountered a problem when looking up teams" + }, + { + "id": "store.sql_team.permanent_delete.app_error", + "translation": "We couldn't delete the existing team" + }, + { + "id": "store.sql_team.save.app_error", + "translation": "We couldn't save the team" + }, + { + "id": "store.sql_team.save.domain_exists.app_error", + "translation": "A team with that domain already exists" + }, + { + "id": "store.sql_team.save.existing.app_error", + "translation": "Must call update for exisiting team" + }, + { + "id": "store.sql_team.update.app_error", + "translation": "We couldn't update the team" + }, + { + "id": "store.sql_team.update.find.app_error", + "translation": "We couldn't find the existing team to update" + }, + { + "id": "store.sql_team.update.finding.app_error", + "translation": "We encountered an error finding the team" + }, + { + "id": "store.sql_team.update.updating.app_error", + "translation": "We encountered an error updating the team" + }, + { + "id": "store.sql_team.update_display_name.app_error", + "translation": "We couldn't update the team name" + }, + { + "id": "store.sql_user.analytics_unique_user_count.app_error", + "translation": "We couldn't get the unique user count" + }, + { + "id": "store.sql_user.get.app_error", + "translation": "We encountered an error finding the account" + }, + { + "id": "store.sql_user.get_by_auth.app_error", + "translation": "We couldn't find an existing account matching your authentication type for this team. This team may require an invite from the team owner to join." + }, + { + "id": "store.sql_user.get_by_username.app_error", + "translation": "We couldn't find an existing account matching your username for this team. This team may require an invite from the team owner to join." + }, + { + "id": "store.sql_user.get_for_export.app_error", + "translation": "We encountered an error while finding user profiles" + }, + { + "id": "store.sql_user.get_profiles.app_error", + "translation": "We encountered an error while finding user profiles" + }, + { + "id": "store.sql_user.get_sysadmin_profiles.app_error", + "translation": "We encountered an error while finding user profiles" + }, + { + "id": "store.sql_user.get_total_active_users_count.app_error", + "translation": "We could not count the users" + }, + { + "id": "store.sql_user.get_total_users_count.app_error", + "translation": "We could not count the users" + }, + { + "id": "store.sql_user.missing_account.const", + "translation": "We couldn't find an existing account matching your email address for this team. This team may require an invite from the team owner to join." + }, + { + "id": "store.sql_user.permanent_delete.app_error", + "translation": "We couldn't delete the existing account" + }, + { + "id": "store.sql_user.save.app_error", + "translation": "We couldn't save the account." + }, + { + "id": "store.sql_user.save.email_exists.app_error", + "translation": "An account with that email already exists." + }, + { + "id": "store.sql_user.save.existing.app_error", + "translation": "Must call update for exisiting user" + }, + { + "id": "store.sql_user.save.max_accounts.app_error", + "translation": "This team has reached the maxmium number of allowed accounts. Contact your systems administrator to set a higher limit." + }, + { + "id": "store.sql_user.save.member_count.app_error", + "translation": "Failed to get current team member count" + }, + { + "id": "store.sql_user.save.username_exists.app_error", + "translation": "An account with that username already exists." + }, + { + "id": "store.sql_user.update.app_error", + "translation": "We couldn't update the account" + }, + { + "id": "store.sql_user.update.email_taken.app_error", + "translation": "This email is already taken. Please choose another." + }, + { + "id": "store.sql_user.update.find.app_error", + "translation": "We couldn't find the existing account to update" + }, + { + "id": "store.sql_user.update.finding.app_error", + "translation": "We encountered an error finding the account" + }, + { + "id": "store.sql_user.update.updating.app_error", + "translation": "We encountered an error updating the account" + }, + { + "id": "store.sql_user.update.username_taken.app_error", + "translation": "This username is already taken. Please choose another." + }, + { + "id": "store.sql_user.update_auth_data.app_error", + "translation": "We couldn't update the auth data" + }, + { + "id": "store.sql_user.update_failed_pwd_attempts.app_error", + "translation": "We couldn't update the failed_attempts" + }, + { + "id": "store.sql_user.update_last_activity.app_error", + "translation": "We couldn't update the last_activity_at" + }, + { + "id": "store.sql_user.update_last_picture_update.app_error", + "translation": "We couldn't update the update_at" + }, + { + "id": "store.sql_user.update_last_ping.app_error", + "translation": "We couldn't update the last_ping_at" + }, + { + "id": "store.sql_user.update_password.app_error", + "translation": "We couldn't update the user password" + }, + { + "id": "store.sql_user.verify_email.app_error", + "translation": "Unable to update verify email field" + }, + { + "id": "store.sql_webhooks.delete_incoming.app_error", + "translation": "We couldn't delete the webhook" + }, + { + "id": "store.sql_webhooks.delete_outgoing.app_error", + "translation": "We couldn't delete the webhook" + }, + { + "id": "store.sql_webhooks.get_incoming.app_error", + "translation": "We couldn't get the webhook" + }, + { + "id": "store.sql_webhooks.get_incoming_by_channel.app_error", + "translation": "We couldn't get the webhooks" + }, + { + "id": "store.sql_webhooks.get_incoming_by_user.app_error", + "translation": "We couldn't get the webhook" + }, + { + "id": "store.sql_webhooks.get_outgoing.app_error", + "translation": "We couldn't get the webhook" + }, + { + "id": "store.sql_webhooks.get_outgoing_by_channel.app_error", + "translation": "We couldn't get the webhooks" + }, + { + "id": "store.sql_webhooks.get_outgoing_by_creator.app_error", + "translation": "We couldn't get the webhooks" + }, + { + "id": "store.sql_webhooks.get_outgoing_by_team.app_error", + "translation": "We couldn't get the webhooks" + }, + { + "id": "store.sql_webhooks.permanent_delete_incoming_by_user.app_error", + "translation": "We couldn't delete the webhook" + }, + { + "id": "store.sql_webhooks.permanent_delete_outgoing_by_user.app_error", + "translation": "We couldn't delete the webhook" + }, + { + "id": "store.sql_webhooks.save_incoming.app_error", + "translation": "We couldn't save the IncomingWebhook" + }, + { + "id": "store.sql_webhooks.save_incoming.existing.app_error", + "translation": "You cannot overwrite an existing IncomingWebhook" + }, + { + "id": "store.sql_webhooks.save_outgoing.app_error", + "translation": "We couldn't save the OutgoingWebhook" + }, + { + "id": "store.sql_webhooks.save_outgoing.override.app_error", + "translation": "You cannot overwrite an existing OutgoingWebhook" + }, + { + "id": "store.sql_webhooks.update_outgoing.app_error", + "translation": "We couldn't update the webhook" + }, { "id": "utils.config.load_config.decoding.panic", "translation": "Error decoding config file={{.Filename}}, err={{.Error}}" diff --git a/i18n/es.json b/i18n/es.json index 57dd22bc8..4116d3cce 100644 --- a/i18n/es.json +++ b/i18n/es.json @@ -2155,6 +2155,846 @@ "id": "model.utils.decode_json.app_error", "translation": "no se puede decodificar" }, + { + "id": "store.sql.check_index.critical", + "translation": "Falla al revisar el indice %v" + }, + { + "id": "store.sql.closing.info", + "translation": "Cerrando SqlStore" + }, + { + "id": "store.sql.column_exists.critical", + "translation": "Falla al revisar si la columna existe %v" + }, + { + "id": "store.sql.column_exists_missing_driver.critical", + "translation": "Falla al revisar si la columna existe porque el controlador no se encuentra" + }, + { + "id": "store.sql.convert_encrypt_string_map", + "translation": "Desde BD: No se puede convertir EncryptStringMap a *string" + }, + { + "id": "store.sql.convert_string_array", + "translation": "Desde BD: No se puede convertir StringArray a *string" + }, + { + "id": "store.sql.convert_string_interface", + "translation": "Desde BD: No se puede convertir StringInterface a *string" + }, + { + "id": "store.sql.convert_string_map", + "translation": "Desde BD: No se puede convertir StringMap a *string" + }, + { + "id": "store.sql.create_column.critical", + "translation": "Falla al crear la columna %v" + }, + { + "id": "store.sql.create_column_missing_driver.critical", + "translation": "Falla al crear la columna porque el controlador no se encuentra" + }, + { + "id": "store.sql.create_index.critical", + "translation": "Falla al crear el indice %v" + }, + { + "id": "store.sql.create_index_missing_driver.critical", + "translation": "Falla al crear el indice porque el controlador no se encuentra" + }, + { + "id": "store.sql.creating_tables.critical", + "translation": "Error creando las tablas de la base de datos: %v" + }, + { + "id": "store.sql.dialect_driver.critical", + "translation": "Falla al crear el controlador de base de datos especificado" + }, + { + "id": "store.sql.dialect_driver.panic", + "translation": "Failed to create dialect specific driver %v" + }, + { + "id": "store.sql.drop_column.critical", + "translation": "Falla al borrar la columna %v" + }, + { + "id": "store.sql.incorrect_mac", + "translation": "MAC incorrecto para el ciphertext dado" + }, + { + "id": "store.sql.open_conn.critical", + "translation": "Falla al abrir una conexión sql a err:%v" + }, + { + "id": "store.sql.open_conn.panic", + "translation": "Failed to open sql connection %v" + }, + { + "id": "store.sql.ping.critical", + "translation": "Falla al hacer ping a la base de datos err:%v" + }, + { + "id": "store.sql.pinging.info", + "translation": "Verificando conexión con la base de datos sql %v" + }, + { + "id": "store.sql.rename_column.critical", + "translation": "Falla al renombrar la columna %v" + }, + { + "id": "store.sql.schema_out_of_date.warn", + "translation": "La versión del esquema de la base de datos %v parece estar desactualizada" + }, + { + "id": "store.sql.schema_set.info", + "translation": "El esquema de la base de datos ha sido asignado a la versión %v" + }, + { + "id": "store.sql.schema_upgrade_attempt.warn", + "translation": "Intentando actualizar el esquema de la base de datos a la versión %v" + }, + { + "id": "store.sql.schema_version.critical", + "translation": "La version del esquema de la base de datos %v no puede ser actualizada. No debes saltarte ninguna versión anterior." + }, + { + "id": "store.sql.short_ciphertext", + "translation": "ciphertext corto" + }, + { + "id": "store.sql.table_column_type.critical", + "translation": "Falla al obtener el tipo de dato de la columna %s de la tabla %s: %v" + }, + { + "id": "store.sql.table_exists.critical", + "translation": "Falla al revisar si la tabla existe %v" + }, + { + "id": "store.sql.too_short_ciphertext", + "translation": "ciphertext muy corto" + }, + { + "id": "store.sql.upgraded.warn", + "translation": "El esquema de la base de datos ha sido actualizado a la versión %v" + }, + { + "id": "store.sql_audit.get.finding.app_error", + "translation": "Encontramos un error al buscar las auditorias" + }, + { + "id": "store.sql_audit.get.limit.app_error", + "translation": "Límite de paginación excedido" + }, + { + "id": "store.sql_audit.permanent_delete_by_user.app_error", + "translation": "Encontramos un error al eliminar los audits" + }, + { + "id": "store.sql_audit.save.saving.app_error", + "translation": "Encontramos un error guardando la auditoria" + }, + { + "id": "store.sql_channel.analytics_type_count.app_error", + "translation": "No pudimos obtener la cantidad de canales de este tipo" + }, + { + "id": "store.sql_channel.check_open_channel_permissions.app_error", + "translation": "No pudimos revisar los permisos" + }, + { + "id": "store.sql_channel.check_permissions.app_error", + "translation": "No pudimos revisar los permisos" + }, + { + "id": "store.sql_channel.check_permissions_by_name.app_error", + "translation": "No pudimos revisar los permisos" + }, + { + "id": "store.sql_channel.delete.channel.app_error", + "translation": "No pudimos eliminar el canal" + }, + { + "id": "store.sql_channel.extra_updated.app_error", + "translation": "Problema actualizando el último momento de actualización de los miembros" + }, + { + "id": "store.sql_channel.get.existing.app_error", + "translation": "No pudimos encontrar el canal" + }, + { + "id": "store.sql_channel.get.find.app_error", + "translation": "Encontramos un error buscando el canal" + }, + { + "id": "store.sql_channel.get_by_name.existing.app_error", + "translation": "No pudimos encontrar el canal" + }, + { + "id": "store.sql_channel.get_channel_counts.get.app_error", + "translation": "No pudimos obtener la cantidad de canales" + }, + { + "id": "store.sql_channel.get_channels.get.app_error", + "translation": "No pudimos obtener los canales" + }, + { + "id": "store.sql_channel.get_channels.not_found.app_error", + "translation": "No se encontró ningún canal" + }, + { + "id": "store.sql_channel.get_extra_members.app_error", + "translation": "No pudimos obtener información extra de los miembros del canal" + }, + { + "id": "store.sql_channel.get_for_export.app_error", + "translation": "No pudimos obtener todos los canales" + }, + { + "id": "store.sql_channel.get_member.app_error", + "translation": "No pudimos obtener el miembro del canal" + }, + { + "id": "store.sql_channel.get_member_count.app_error", + "translation": "No pudimos obtener la cantidad de miembros del canal" + }, + { + "id": "store.sql_channel.get_members.app_error", + "translation": "No pudimos obtener los miembros del canal" + }, + { + "id": "store.sql_channel.get_more_channels.get.app_error", + "translation": "No pudimos obtener los canales" + }, + { + "id": "store.sql_channel.increment_mention_count.app_error", + "translation": "No pudimos incrementar la cantidad de menciones" + }, + { + "id": "store.sql_channel.permanent_delete_by_team.app_error", + "translation": "No pudimos eliminar los canales" + }, + { + "id": "store.sql_channel.permanent_delete_members_by_user.app_error", + "translation": "No pudimos remover al miembro del canal" + }, + { + "id": "store.sql_channel.remove_member.app_error", + "translation": "No pudimos remover al miembro del canal" + }, + { + "id": "store.sql_channel.save.commit_transaction.app_error", + "translation": "No se puede perpetrar la transacción" + }, + { + "id": "store.sql_channel.save.direct_channel.app_error", + "translation": "Utiliza SaveDirectChannel para crear un canal directo" + }, + { + "id": "store.sql_channel.save.open_transaction.app_error", + "translation": "No se puede abrir la transacción" + }, + { + "id": "store.sql_channel.save_channel.current_count.app_error", + "translation": "Falla obteniendo la cantidad de canales actual" + }, + { + "id": "store.sql_channel.save_channel.existing.app_error", + "translation": "Debe llamarse a actualizar para un canal existente" + }, + { + "id": "store.sql_channel.save_channel.exists.app_error", + "translation": "Un canal con este URL ya existe" + }, + { + "id": "store.sql_channel.save_channel.limit.app_error", + "translation": "Se ha alcanzado el límite de canales permitidos." + }, + { + "id": "store.sql_channel.save_channel.previously.app_error", + "translation": "Un canal con este URL fue creado previamente" + }, + { + "id": "store.sql_channel.save_channel.save.app_error", + "translation": "No pudimos guardar el canal" + }, + { + "id": "store.sql_channel.save_direct_channel.add_members.app_error", + "translation": "No se pueden agregar miembros a un canal directo" + }, + { + "id": "store.sql_channel.save_direct_channel.commit.app_error", + "translation": "No se puede perpetrar la transacción" + }, + { + "id": "store.sql_channel.save_direct_channel.not_direct.app_error", + "translation": "No es un canal directo, se intentó crear con SaveDirectChannel" + }, + { + "id": "store.sql_channel.save_direct_channel.open_transaction.app_error", + "translation": "No se puede abrir la transacción" + }, + { + "id": "store.sql_channel.save_member.commit_transaction.app_error", + "translation": "No se puede perpetrar la transacción" + }, + { + "id": "store.sql_channel.save_member.exists.app_error", + "translation": "Un miembro del canal con este id ya existe" + }, + { + "id": "store.sql_channel.save_member.open_transaction.app_error", + "translation": "No se puede abrir la transacción" + }, + { + "id": "store.sql_channel.save_member.save.app_error", + "translation": "No pudimos guardar el miembro del canal" + }, + { + "id": "store.sql_channel.update.app_error", + "translation": "No pudimos actualizar el canal" + }, + { + "id": "store.sql_channel.update.exists.app_error", + "translation": "Un canal con este identificador ya existe" + }, + { + "id": "store.sql_channel.update.previously.app_error", + "translation": "Un canal con este identificador fue creado previamente" + }, + { + "id": "store.sql_channel.update.updating.app_error", + "translation": "Encontramos un error actualizando el canal" + }, + { + "id": "store.sql_channel.update_last_viewed_at.app_error", + "translation": "No pudimos actualizar el tiempo de la última vista" + }, + { + "id": "store.sql_channel.update_member.app_error", + "translation": "Encontramos un error actualizando el miembro del canal" + }, + { + "id": "store.sql_oauth.get_access_data.app_error", + "translation": "Encontramos un error buscando el token de acceso" + }, + { + "id": "store.sql_oauth.get_access_data_by_code.app_error", + "translation": "Encontramos un error buscando el token de acceso" + }, + { + "id": "store.sql_oauth.get_app.find.app_error", + "translation": "No pudimos encontrar la app" + }, + { + "id": "store.sql_oauth.get_app.finding.app_error", + "translation": "Encontramos un error buscando la app" + }, + { + "id": "store.sql_oauth.get_app_by_user.find.app_error", + "translation": "No pudimos encontrar ninguna app" + }, + { + "id": "store.sql_oauth.get_auth_data.find.app_error", + "translation": "No pudimos encontrar el código de autorización" + }, + { + "id": "store.sql_oauth.get_auth_data.finding.app_error", + "translation": "Encontramos un error buscando el código de autorización" + }, + { + "id": "store.sql_oauth.permanent_delete_auth_data_by_user.app_error", + "translation": "No pudimos remover el código de autorización" + }, + { + "id": "store.sql_oauth.remove_access_data.app_error", + "translation": "No pudimos remover el token de acceso" + }, + { + "id": "store.sql_oauth.remove_auth_data.app_error", + "translation": "No pudimos remover el código de autorización" + }, + { + "id": "store.sql_oauth.save_access_data.app_error", + "translation": "No pudimos guardar el token de acceso." + }, + { + "id": "store.sql_oauth.save_app.existing.app_error", + "translation": "Se debe ejecutar actualizar para una app existente" + }, + { + "id": "store.sql_oauth.save_app.save.app_error", + "translation": "No pudimos guardar el app." + }, + { + "id": "store.sql_oauth.save_auth_data.app_error", + "translation": "No pudimos guardar el código de autorización." + }, + { + "id": "store.sql_oauth.update_app.find.app_error", + "translation": "No pudimos encontrar una app para actualizar" + }, + { + "id": "store.sql_oauth.update_app.finding.app_error", + "translation": "Encontramos un error buscando la app" + }, + { + "id": "store.sql_oauth.update_app.update.app_error", + "translation": "No pudimos actualizar la app" + }, + { + "id": "store.sql_oauth.update_app.updating.app_error", + "translation": "Encontramos un error actualizando la app" + }, + { + "id": "store.sql_post.analytics_posts_count.app_error", + "translation": "No pudimos obtener la cantidad de mensajes" + }, + { + "id": "store.sql_post.analytics_posts_count_by_day.app_error", + "translation": "No pudimos obtener la cantidad de mensajes por día" + }, + { + "id": "store.sql_post.analytics_user_counts_posts_by_day.app_error", + "translation": "No pudimos obtener la cantidad de usuarios con mensajes" + }, + { + "id": "store.sql_post.delete.app_error", + "translation": "No pudimos eliminar el mensaje" + }, + { + "id": "store.sql_post.get.app_error", + "translation": "No pudimos obtener el mensaje" + }, + { + "id": "store.sql_post.get_for_export.app_error", + "translation": "No pudimos obtener los mensajes para el canal" + }, + { + "id": "store.sql_post.get_parents_posts.app_error", + "translation": "No pudimos obtener los mensajes padres del canal" + }, + { + "id": "store.sql_post.get_posts.app_error", + "translation": "Límite de paginación excedido" + }, + { + "id": "store.sql_post.get_posts_around.get.app_error", + "translation": "No pudimos obtener los mensajes para el canal" + }, + { + "id": "store.sql_post.get_posts_around.get_parent.app_error", + "translation": "No pudimos obtener los mensajes padres del canal" + }, + { + "id": "store.sql_post.get_posts_since.app_error", + "translation": "No pudimos obtener los mensajes para el canal" + }, + { + "id": "store.sql_post.get_root_posts.app_error", + "translation": "No pudimos obtener los mensajes para el canal" + }, + { + "id": "store.sql_post.permanent_delete.app_error", + "translation": "No pudimos eliminar el mensaje" + }, + { + "id": "store.sql_post.permanent_delete_all_comments_by_user.app_error", + "translation": "No pudimos eliminar los comentarios para el usuario" + }, + { + "id": "store.sql_post.permanent_delete_by_user.app_error", + "translation": "No pudimos seleccionar los mensajes a borrar para el usuario" + }, + { + "id": "store.sql_post.permanent_delete_by_user.too_many.app_error", + "translation": "No pudimos seleccionar todos los mensajes a eliminar por el usuario (son demasiados), por favor ejecuta de nuevo" + }, + { + "id": "store.sql_post.save.app_error", + "translation": "No pudimos guardar el Mensaje" + }, + { + "id": "store.sql_post.save.existing.app_error", + "translation": "No puedes actualizar el Mensaje" + }, + { + "id": "store.sql_post.search.app_error", + "translation": "Encontramos un error mientras buscabamos los mensajes" + }, + { + "id": "store.sql_post.update.app_error", + "translation": "No pudimos actualizar el Mensaje" + }, + { + "id": "store.sql_preference.delete_unused_features.debug", + "translation": "Eliminando las características de pre-release" + }, + { + "id": "store.sql_preference.get.app_error", + "translation": "Encontramos un error mientras buscabamos las preferencias" + }, + { + "id": "store.sql_preference.get_all.app_error", + "translation": "Encontramos un error mientras buscabamos las preferencias" + }, + { + "id": "store.sql_preference.get_category.app_error", + "translation": "Encontramos un error mientras buscabamos las preferencias" + }, + { + "id": "store.sql_preference.insert.exists.app_error", + "translation": "La preferencia para ese usuario, categoria y nombre ya existe" + }, + { + "id": "store.sql_preference.insert.save.app_error", + "translation": "No pudimos guardar la preferencia" + }, + { + "id": "store.sql_preference.is_feature_enabled.app_error", + "translation": "Encontramos un error mientras buscabamos las preferencias de las características de pre-lanzamiento" + }, + { + "id": "store.sql_preference.permanent_delete_by_user.app_error", + "translation": "Encontramos un error mientras eliminabamos las preferencias" + }, + { + "id": "store.sql_preference.save.commit_transaction.app_error", + "translation": "No se pudo hacer commit de la transacción para guardar las preferencias" + }, + { + "id": "store.sql_preference.save.missing_driver.app_error", + "translation": "Encontramos un error mientras actualizabamos las preferencias" + }, + { + "id": "store.sql_preference.save.open_transaction.app_error", + "translation": "No se pudo abrir la transacción para guardar las preferencias" + }, + { + "id": "store.sql_preference.save.rollback_transaction.app_error", + "translation": "No se pudo deshacer la transaccion para guardar las preferencias" + }, + { + "id": "store.sql_preference.save.updating.app_error", + "translation": "Encontramos un error mientras actualizabamos las preferencias" + }, + { + "id": "store.sql_preference.update.app_error", + "translation": "No pudimos actualizar la preferencia" + }, + { + "id": "store.sql_session.cleanup_expired_sessions.app_error", + "translation": "Encontramos un error mientras se eliminaban las sesiones expiradas del usuario" + }, + { + "id": "store.sql_session.get.app_error", + "translation": "Encontramos un error buscando las sesiones" + }, + { + "id": "store.sql_session.get_sessions.app_error", + "translation": "Encontramos un error mientras buscabamos las sesiones de usuario" + }, + { + "id": "store.sql_session.get_sessions.error", + "translation": "Falla al limpiar las sesiones en getSessions err=%v" + }, + { + "id": "store.sql_session.permanent_delete_sessions_by_user.app_error", + "translation": "No pudimos remover todas las sesiones del usuario" + }, + { + "id": "store.sql_session.remove.app_error", + "translation": "No pudimos remover la sesión" + }, + { + "id": "store.sql_session.remove_all_sessions_for_team.app_error", + "translation": "No pudimos remover todas las sesiones para el equipo" + }, + { + "id": "store.sql_session.save.app_error", + "translation": "No pudimos guardar la sesión" + }, + { + "id": "store.sql_session.save.cleanup.error", + "translation": "Falla al limpiar las sesiones mientras se Guardaba err=%v" + }, + { + "id": "store.sql_session.save.existing.app_error", + "translation": "No se puede actualizar la sesión" + }, + { + "id": "store.sql_session.update_last_activity.app_error", + "translation": "No pudimos actualizar el campo last_activity_at" + }, + { + "id": "store.sql_session.update_roles.app_error", + "translation": "No pudimos actualizar los roles" + }, + { + "id": "store.sql_system.get.app_error", + "translation": "Encontramos un error buscando las propiedades del sistema" + }, + { + "id": "store.sql_system.save.app_error", + "translation": "Entrontramos un error mientras se guardaban las propiedades del sistema" + }, + { + "id": "store.sql_system.update.app_error", + "translation": "Encontramos un error actualizando las propiedades del sistema" + }, + { + "id": "store.sql_team.get.find.app_error", + "translation": "No encontramos el equipo al que perteneces" + }, + { + "id": "store.sql_team.get.finding.app_error", + "translation": "Encontramos un error buscando el equipo" + }, + { + "id": "store.sql_team.get_all.app_error", + "translation": "No pudimos obtener todos los equipos" + }, + { + "id": "store.sql_team.get_all_team_listing.app_error", + "translation": "No pudimos obtener todos los equipos" + }, + { + "id": "store.sql_team.get_by_invite_id.find.app_error", + "translation": "No encontramos el equipo al que perteneces" + }, + { + "id": "store.sql_team.get_by_invite_id.finding.app_error", + "translation": "No encontramos el equipo al que perteneces" + }, + { + "id": "store.sql_team.get_by_name.app_error", + "translation": "No encontramos el equipo al que perteneces" + }, + { + "id": "store.sql_team.get_teams_for_email.app_error", + "translation": "Encontramos un problema cuando buscabamos los equipos" + }, + { + "id": "store.sql_team.permanent_delete.app_error", + "translation": "No pudimos eliminar el equipo" + }, + { + "id": "store.sql_team.save.app_error", + "translation": "No pudimos guardar el equipo" + }, + { + "id": "store.sql_team.save.domain_exists.app_error", + "translation": "Ya existe un equipo con ese dominio" + }, + { + "id": "store.sql_team.save.existing.app_error", + "translation": "Debe ejecturase actualizar para un equipo existente" + }, + { + "id": "store.sql_team.update.app_error", + "translation": "No pudimos actualizar el equipo" + }, + { + "id": "store.sql_team.update.find.app_error", + "translation": "No pudimos encontrar el equipo a actualizar" + }, + { + "id": "store.sql_team.update.finding.app_error", + "translation": "Encontramos un error buscando el equipo" + }, + { + "id": "store.sql_team.update.updating.app_error", + "translation": "Encontramos un error actualizando el equipo" + }, + { + "id": "store.sql_team.update_display_name.app_error", + "translation": "No pudimos actualizar el nombre del equipo" + }, + { + "id": "store.sql_user.analytics_unique_user_count.app_error", + "translation": "No se pudo obtener el conteo de usuarios unicos" + }, + { + "id": "store.sql_user.get.app_error", + "translation": "Encontramos un error buscando la cuenta" + }, + { + "id": "store.sql_user.get_by_auth.app_error", + "translation": "No pudimos encontrar una cuenta existente que coincida con tu tipo de autenticación para este equipo. Es posible que necesites una invitación por aprte del dueño del equipo para unirte." + }, + { + "id": "store.sql_user.get_by_username.app_error", + "translation": "No pudimos encontrar una cuenta existente que coincida con tu nombre de usuario para este equipo. Es posible que necesites una invitación por aprte del dueño del equipo para unirte." + }, + { + "id": "store.sql_user.get_for_export.app_error", + "translation": "Encontramos un error mientras buscabamos los perfiles de usuario" + }, + { + "id": "store.sql_user.get_profiles.app_error", + "translation": "Encontramos un error mientras buscabamos los perfiles de usuario" + }, + { + "id": "store.sql_user.get_sysadmin_profiles.app_error", + "translation": "Encontramos un error mientras buscabamos los perfiles de usuario" + }, + { + "id": "store.sql_user.get_total_active_users_count.app_error", + "translation": "No pudimos contar los usuarios" + }, + { + "id": "store.sql_user.get_total_users_count.app_error", + "translation": "No pudimos contar los usuarios" + }, + { + "id": "store.sql_user.missing_account.const", + "translation": "No pudimos encontrar una cuenta existente que coincida con tu dirección de correo electrónico para este equipo. Es posible que necesites una invitación del dueño del equipo para poder unirte." + }, + { + "id": "store.sql_user.permanent_delete.app_error", + "translation": "No pudimos eliminar la cuenta" + }, + { + "id": "store.sql_user.save.app_error", + "translation": "No pudimos guardar la cuenta." + }, + { + "id": "store.sql_user.save.email_exists.app_error", + "translation": "Ya existe una cuenta con ese correo electrónico." + }, + { + "id": "store.sql_user.save.existing.app_error", + "translation": "Debe ejecutarse actualizar para un usuario existente" + }, + { + "id": "store.sql_user.save.max_accounts.app_error", + "translation": "Este equipo ha alcanzado el número máximo de cuentas permitidas. Contacta a un administrador de sistema para que asigne un límite mayor." + }, + { + "id": "store.sql_user.save.member_count.app_error", + "translation": "Falla obteniendo la cantidad de miembros del equipo actual" + }, + { + "id": "store.sql_user.save.username_exists.app_error", + "translation": "Una cuenta con ese nombre de usuario ya existe." + }, + { + "id": "store.sql_user.update.app_error", + "translation": "No pudimos realizar la actualización de los datos de la cuenta" + }, + { + "id": "store.sql_user.update.email_taken.app_error", + "translation": "Este correo electrónico ya está siendo utilizado. Por favor escoge otro." + }, + { + "id": "store.sql_user.update.find.app_error", + "translation": "No pudimos encontrar la cuenta a actualizar" + }, + { + "id": "store.sql_user.update.finding.app_error", + "translation": "Encontramos un error buscando la cuenta" + }, + { + "id": "store.sql_user.update.updating.app_error", + "translation": "Encontramos un error actualizando la cuenta" + }, + { + "id": "store.sql_user.update.username_taken.app_error", + "translation": "Este nombre de usuario ya está siendo utiizado. Por favor selecciona otro." + }, + { + "id": "store.sql_user.update_auth_data.app_error", + "translation": "No pudimos actualizar la data de autorización" + }, + { + "id": "store.sql_user.update_failed_pwd_attempts.app_error", + "translation": "No pudimos actualizar el campo failed_attempts" + }, + { + "id": "store.sql_user.update_last_activity.app_error", + "translation": "No pudimos actualizar el campo last_activity_at" + }, + { + "id": "store.sql_user.update_last_picture_update.app_error", + "translation": "No pudimos actualizar el campo update_at" + }, + { + "id": "store.sql_user.update_last_ping.app_error", + "translation": "No pudimos actualizar el campo last_ping_at" + }, + { + "id": "store.sql_user.update_password.app_error", + "translation": "No pudimos actualizar la contraseña del usuario" + }, + { + "id": "store.sql_user.verify_email.app_error", + "translation": "No se puede actualizar el campo de verificar correo" + }, + { + "id": "store.sql_webhooks.delete_incoming.app_error", + "translation": "No pudimos eliminar el webhook" + }, + { + "id": "store.sql_webhooks.delete_outgoing.app_error", + "translation": "No pudimos eliminar el webhook" + }, + { + "id": "store.sql_webhooks.get_incoming.app_error", + "translation": "No pudimos obtener el webhook" + }, + { + "id": "store.sql_webhooks.get_incoming_by_channel.app_error", + "translation": "No pudimos obtener los webhooks" + }, + { + "id": "store.sql_webhooks.get_incoming_by_user.app_error", + "translation": "No pudimos obtener el webhook" + }, + { + "id": "store.sql_webhooks.get_outgoing.app_error", + "translation": "No pudimos obtener el webhook" + }, + { + "id": "store.sql_webhooks.get_outgoing_by_channel.app_error", + "translation": "No pudimos obtener los webhooks" + }, + { + "id": "store.sql_webhooks.get_outgoing_by_creator.app_error", + "translation": "No pudimos obtener los webhooks" + }, + { + "id": "store.sql_webhooks.get_outgoing_by_team.app_error", + "translation": "No pudimos obtener los webhooks" + }, + { + "id": "store.sql_webhooks.permanent_delete_incoming_by_user.app_error", + "translation": "No pudimos eliminar el webhook" + }, + { + "id": "store.sql_webhooks.permanent_delete_outgoing_by_user.app_error", + "translation": "No pudimos eliminar el webhook" + }, + { + "id": "store.sql_webhooks.save_incoming.app_error", + "translation": "No pudimos guardar el Webhook de Entrada" + }, + { + "id": "store.sql_webhooks.save_incoming.existing.app_error", + "translation": "No puedes sobreescribir un Webhook de Entrada existente" + }, + { + "id": "store.sql_webhooks.save_outgoing.app_error", + "translation": "No pudimos guardar el Webhook de Salida" + }, + { + "id": "store.sql_webhooks.save_outgoing.override.app_error", + "translation": "No puedes sobreescribir un Webhook de Salida existente" + }, + { + "id": "store.sql_webhooks.update_outgoing.app_error", + "translation": "No pudimos actualizar el webhook" + }, { "id": "utils.config.load_config.decoding.panic", "translation": "Error decifrando la configuración del archivo={{.Filename}}, err={{.Error}}" diff --git a/store/sql_audit_store.go b/store/sql_audit_store.go index f4fd29aab..97df5f7e7 100644 --- a/store/sql_audit_store.go +++ b/store/sql_audit_store.go @@ -45,8 +45,8 @@ func (s SqlAuditStore) Save(audit *model.Audit) StoreChannel { audit.CreateAt = model.GetMillis() if err := s.GetMaster().Insert(audit); err != nil { - result.Err = model.NewAppError("SqlAuditStore.Save", - "We encountered an error saving the audit", "user_id="+ + result.Err = model.NewLocAppError("SqlAuditStore.Save", + "store.sql_audit.save.saving.app_error", nil, "user_id="+ audit.UserId+" action="+audit.Action) } @@ -66,7 +66,7 @@ func (s SqlAuditStore) Get(user_id string, limit int) StoreChannel { if limit > 1000 { limit = 1000 - result.Err = model.NewAppError("SqlAuditStore.Get", "Limit exceeded for paging", "user_id="+user_id) + result.Err = model.NewLocAppError("SqlAuditStore.Get", "store.sql_audit.get.limit.app_error", nil, "user_id="+user_id) storeChannel <- result close(storeChannel) return @@ -75,7 +75,7 @@ func (s SqlAuditStore) Get(user_id string, limit int) StoreChannel { var audits model.Audits if _, err := s.GetReplica().Select(&audits, "SELECT * FROM Audits WHERE UserId = :user_id ORDER BY CreateAt DESC LIMIT :limit", map[string]interface{}{"user_id": user_id, "limit": limit}); err != nil { - result.Err = model.NewAppError("SqlAuditStore.Get", "We encountered an error finding the audits", "user_id="+user_id) + result.Err = model.NewLocAppError("SqlAuditStore.Get", "store.sql_audit.get.finding.app_error", nil, "user_id="+user_id) } else { result.Data = audits } @@ -96,7 +96,7 @@ func (s SqlAuditStore) PermanentDeleteByUser(userId string) StoreChannel { if _, err := s.GetMaster().Exec("DELETE FROM Audits WHERE UserId = :userId", map[string]interface{}{"userId": userId}); err != nil { - result.Err = model.NewAppError("SqlAuditStore.Delete", "We encountered an error deleting the audits", "user_id="+userId) + result.Err = model.NewLocAppError("SqlAuditStore.Delete", "store.sql_audit.permanent_delete_by_user.app_error", nil, "user_id="+userId) } storeChannel <- result diff --git a/store/sql_channel_store.go b/store/sql_channel_store.go index 7400df8d2..8b52dae12 100644 --- a/store/sql_channel_store.go +++ b/store/sql_channel_store.go @@ -55,17 +55,17 @@ func (s SqlChannelStore) Save(channel *model.Channel) StoreChannel { go func() { var result StoreResult if channel.Type == model.CHANNEL_DIRECT { - result.Err = model.NewAppError("SqlChannelStore.Save", "Use SaveDirectChannel to create a direct channel", "") + result.Err = model.NewLocAppError("SqlChannelStore.Save", "store.sql_channel.save.direct_channel.app_error", nil, "") } else { if transaction, err := s.GetMaster().Begin(); err != nil { - result.Err = model.NewAppError("SqlChannelStore.Save", "Unable to open transaction", err.Error()) + result.Err = model.NewLocAppError("SqlChannelStore.Save", "store.sql_channel.save.open_transaction.app_error", nil, err.Error()) } else { result = s.saveChannelT(transaction, channel) if result.Err != nil { transaction.Rollback() } else { if err := transaction.Commit(); err != nil { - result.Err = model.NewAppError("SqlChannelStore.Save", "Unable to commit transaction", err.Error()) + result.Err = model.NewLocAppError("SqlChannelStore.Save", "store.sql_channel.save.commit_transaction.app_error", nil, err.Error()) } } } @@ -85,10 +85,10 @@ func (s SqlChannelStore) SaveDirectChannel(directchannel *model.Channel, member1 var result StoreResult if directchannel.Type != model.CHANNEL_DIRECT { - result.Err = model.NewAppError("SqlChannelStore.SaveDirectChannel", "Not a direct channel attempted to be created with SaveDirectChannel", "") + result.Err = model.NewLocAppError("SqlChannelStore.SaveDirectChannel", "store.sql_channel.save_direct_channel.not_direct.app_error", nil, "") } else { if transaction, err := s.GetMaster().Begin(); err != nil { - result.Err = model.NewAppError("SqlChannelStore.SaveDirectChannel", "Unable to open transaction", err.Error()) + result.Err = model.NewLocAppError("SqlChannelStore.SaveDirectChannel", "store.sql_channel.save_direct_channel.open_transaction.app_error", nil, err.Error()) } else { channelResult := s.saveChannelT(transaction, directchannel) @@ -113,10 +113,10 @@ func (s SqlChannelStore) SaveDirectChannel(directchannel *model.Channel, member1 if member2Result.Err != nil { details += "Member2Err: " + member2Result.Err.Message } - result.Err = model.NewAppError("SqlChannelStore.SaveDirectChannel", "Unable to add direct channel members", details) + result.Err = model.NewLocAppError("SqlChannelStore.SaveDirectChannel", "store.sql_channel.save_direct_channel.add_members.app_error", nil, details) } else { if err := transaction.Commit(); err != nil { - result.Err = model.NewAppError("SqlChannelStore.SaveDirectChannel", "Ubable to commit transaction", err.Error()) + result.Err = model.NewLocAppError("SqlChannelStore.SaveDirectChannel", "store.sql_channel.save_direct_channel.commit.app_error", nil, err.Error()) } else { result = channelResult } @@ -136,7 +136,7 @@ func (s SqlChannelStore) saveChannelT(transaction *gorp.Transaction, channel *mo result := StoreResult{} if len(channel.Id) > 0 { - result.Err = model.NewAppError("SqlChannelStore.Save", "Must call update for exisiting channel", "id="+channel.Id) + result.Err = model.NewLocAppError("SqlChannelStore.Save", "store.sql_channel.save_channel.existing.app_error", nil, "id="+channel.Id) return result } @@ -147,10 +147,10 @@ func (s SqlChannelStore) saveChannelT(transaction *gorp.Transaction, channel *mo if channel.Type != model.CHANNEL_DIRECT { if count, err := transaction.SelectInt("SELECT COUNT(0) FROM Channels WHERE TeamId = :TeamId AND DeleteAt = 0 AND (Type = 'O' OR Type = 'P')", map[string]interface{}{"TeamId": channel.TeamId}); err != nil { - result.Err = model.NewAppError("SqlChannelStore.Save", "Failed to get current channel count", "teamId="+channel.TeamId+", "+err.Error()) + result.Err = model.NewLocAppError("SqlChannelStore.Save", "store.sql_channel.save_channel.current_count.app_error", nil, "teamId="+channel.TeamId+", "+err.Error()) return result } else if count > 1000 { - result.Err = model.NewAppError("SqlChannelStore.Save", "You've reached the limit of the number of allowed channels.", "teamId="+channel.TeamId) + result.Err = model.NewLocAppError("SqlChannelStore.Save", "store.sql_channel.save_channel.limit.app_error", nil, "teamId="+channel.TeamId) return result } } @@ -160,12 +160,12 @@ func (s SqlChannelStore) saveChannelT(transaction *gorp.Transaction, channel *mo dupChannel := model.Channel{} s.GetMaster().SelectOne(&dupChannel, "SELECT * FROM Channels WHERE TeamId = :TeamId AND Name = :Name AND DeleteAt > 0", map[string]interface{}{"TeamId": channel.TeamId, "Name": channel.Name}) if dupChannel.DeleteAt > 0 { - result.Err = model.NewAppError("SqlChannelStore.Update", "A channel with that URL was previously created", "id="+channel.Id+", "+err.Error()) + result.Err = model.NewLocAppError("SqlChannelStore.Update", "store.sql_channel.save_channel.previously.app_error", nil, "id="+channel.Id+", "+err.Error()) } else { - result.Err = model.NewAppError("SqlChannelStore.Update", "A channel with that URL already exists", "id="+channel.Id+", "+err.Error()) + result.Err = model.NewLocAppError("SqlChannelStore.Update", "store.sql_channel.save_channel.exists.app_error", nil, "id="+channel.Id+", "+err.Error()) } } else { - result.Err = model.NewAppError("SqlChannelStore.Save", "We couldn't save the channel", "id="+channel.Id+", "+err.Error()) + result.Err = model.NewLocAppError("SqlChannelStore.Save", "store.sql_channel.save_channel.save.app_error", nil, "id="+channel.Id+", "+err.Error()) } } else { result.Data = channel @@ -194,15 +194,15 @@ func (s SqlChannelStore) Update(channel *model.Channel) StoreChannel { dupChannel := model.Channel{} s.GetReplica().SelectOne(&dupChannel, "SELECT * FROM Channels WHERE TeamId = :TeamId AND Name= :Name AND DeleteAt > 0", map[string]interface{}{"TeamId": channel.TeamId, "Name": channel.Name}) if dupChannel.DeleteAt > 0 { - result.Err = model.NewAppError("SqlChannelStore.Update", "A channel with that handle was previously created", "id="+channel.Id+", "+err.Error()) + result.Err = model.NewLocAppError("SqlChannelStore.Update", "store.sql_channel.update.previously.app_error", nil, "id="+channel.Id+", "+err.Error()) } else { - result.Err = model.NewAppError("SqlChannelStore.Update", "A channel with that handle already exists", "id="+channel.Id+", "+err.Error()) + result.Err = model.NewLocAppError("SqlChannelStore.Update", "store.sql_channel.update.exists.app_error", nil, "id="+channel.Id+", "+err.Error()) } } else { - result.Err = model.NewAppError("SqlChannelStore.Update", "We encountered an error updating the channel", "id="+channel.Id+", "+err.Error()) + result.Err = model.NewLocAppError("SqlChannelStore.Update", "store.sql_channel.update.updating.app_error", nil, "id="+channel.Id+", "+err.Error()) } } else if count != 1 { - result.Err = model.NewAppError("SqlChannelStore.Update", "We couldn't update the channel", "id="+channel.Id) + result.Err = model.NewLocAppError("SqlChannelStore.Update", "store.sql_channel.update.app_error", nil, "id="+channel.Id) } else { result.Data = channel } @@ -232,7 +232,7 @@ func (s SqlChannelStore) extraUpdated(channel *model.Channel) StoreChannel { map[string]interface{}{"Id": channel.Id, "Time": channel.ExtraUpdateAt}) if err != nil { - result.Err = model.NewAppError("SqlChannelStore.extraUpdated", "Problem updating members last updated time", "id="+channel.Id+", "+err.Error()) + result.Err = model.NewLocAppError("SqlChannelStore.extraUpdated", "store.sql_channel.extra_updated.app_error", nil, "id="+channel.Id+", "+err.Error()) } storeChannel <- result @@ -264,9 +264,9 @@ func (s SqlChannelStore) get(id string, master bool) StoreChannel { } if obj, err := db.Get(model.Channel{}, id); err != nil { - result.Err = model.NewAppError("SqlChannelStore.Get", "We encountered an error finding the channel", "id="+id+", "+err.Error()) + result.Err = model.NewLocAppError("SqlChannelStore.Get", "store.sql_channel.get.find.app_error", nil, "id="+id+", "+err.Error()) } else if obj == nil { - result.Err = model.NewAppError("SqlChannelStore.Get", "We couldn't find the existing channel", "id="+id) + result.Err = model.NewLocAppError("SqlChannelStore.Get", "store.sql_channel.get.existing.app_error", nil, "id="+id) } else { result.Data = obj.(*model.Channel) } @@ -286,7 +286,7 @@ func (s SqlChannelStore) Delete(channelId string, time int64) StoreChannel { _, err := s.GetMaster().Exec("Update Channels SET DeleteAt = :Time, UpdateAt = :Time WHERE Id = :ChannelId", map[string]interface{}{"Time": time, "ChannelId": channelId}) if err != nil { - result.Err = model.NewAppError("SqlChannelStore.Delete", "We couldn't delete the channel", "id="+channelId+", err="+err.Error()) + result.Err = model.NewLocAppError("SqlChannelStore.Delete", "store.sql_channel.delete.channel.app_error", nil, "id="+channelId+", err="+err.Error()) } storeChannel <- result @@ -303,7 +303,7 @@ func (s SqlChannelStore) PermanentDeleteByTeam(teamId string) StoreChannel { result := StoreResult{} if _, err := s.GetMaster().Exec("DELETE FROM Channels WHERE TeamId = :TeamId", map[string]interface{}{"TeamId": teamId}); err != nil { - result.Err = model.NewAppError("SqlChannelStore.PermanentDeleteByTeam", "We couldn't delete the channels", "teamId="+teamId+", "+err.Error()) + result.Err = model.NewLocAppError("SqlChannelStore.PermanentDeleteByTeam", "store.sql_channel.permanent_delete_by_team.app_error", nil, "teamId="+teamId+", "+err.Error()) } storeChannel <- result @@ -328,7 +328,7 @@ func (s SqlChannelStore) GetChannels(teamId string, userId string) StoreChannel _, err := s.GetReplica().Select(&data, "SELECT * FROM Channels, ChannelMembers WHERE Id = ChannelId AND TeamId = :TeamId AND UserId = :UserId AND DeleteAt = 0 ORDER BY DisplayName", map[string]interface{}{"TeamId": teamId, "UserId": userId}) if err != nil { - result.Err = model.NewAppError("SqlChannelStore.GetChannels", "We couldn't get the channels", "teamId="+teamId+", userId="+userId+", err="+err.Error()) + result.Err = model.NewLocAppError("SqlChannelStore.GetChannels", "store.sql_channel.get_channels.get.app_error", nil, "teamId="+teamId+", userId="+userId+", err="+err.Error()) } else { channels := &model.ChannelList{make([]*model.Channel, len(data)), make(map[string]*model.ChannelMember)} for i := range data { @@ -338,7 +338,7 @@ func (s SqlChannelStore) GetChannels(teamId string, userId string) StoreChannel } if len(channels.Channels) == 0 { - result.Err = model.NewAppError("SqlChannelStore.GetChannels", "No channels were found", "teamId="+teamId+", userId="+userId) + result.Err = model.NewLocAppError("SqlChannelStore.GetChannels", "store.sql_channel.get_channels.not_found.app_error", nil, "teamId="+teamId+", userId="+userId) } else { result.Data = channels } @@ -381,7 +381,7 @@ func (s SqlChannelStore) GetMoreChannels(teamId string, userId string) StoreChan map[string]interface{}{"TeamId1": teamId, "TeamId2": teamId, "UserId": userId}) if err != nil { - result.Err = model.NewAppError("SqlChannelStore.GetMoreChannels", "We couldn't get the channels", "teamId="+teamId+", userId="+userId+", err="+err.Error()) + result.Err = model.NewLocAppError("SqlChannelStore.GetMoreChannels", "store.sql_channel.get_more_channels.get.app_error", nil, "teamId="+teamId+", userId="+userId+", err="+err.Error()) } else { result.Data = &model.ChannelList{data, make(map[string]*model.ChannelMember)} } @@ -409,7 +409,7 @@ func (s SqlChannelStore) GetChannelCounts(teamId string, userId string) StoreCha _, err := s.GetReplica().Select(&data, "SELECT Id, TotalMsgCount, UpdateAt FROM Channels WHERE Id IN (SELECT ChannelId FROM ChannelMembers WHERE UserId = :UserId) AND TeamId = :TeamId AND DeleteAt = 0 ORDER BY DisplayName", map[string]interface{}{"TeamId": teamId, "UserId": userId}) if err != nil { - result.Err = model.NewAppError("SqlChannelStore.GetChannelCounts", "We couldn't get the channel counts", "teamId="+teamId+", userId="+userId+", err="+err.Error()) + result.Err = model.NewLocAppError("SqlChannelStore.GetChannelCounts", "store.sql_channel.get_channel_counts.get.app_error", nil, "teamId="+teamId+", userId="+userId+", err="+err.Error()) } else { counts := &model.ChannelCounts{Counts: make(map[string]int64), UpdateTimes: make(map[string]int64)} for i := range data { @@ -437,7 +437,7 @@ func (s SqlChannelStore) GetByName(teamId string, name string) StoreChannel { channel := model.Channel{} if err := s.GetReplica().SelectOne(&channel, "SELECT * FROM Channels WHERE TeamId = :TeamId AND Name= :Name AND DeleteAt = 0", map[string]interface{}{"TeamId": teamId, "Name": name}); err != nil { - result.Err = model.NewAppError("SqlChannelStore.GetByName", "We couldn't find the existing channel", "teamId="+teamId+", "+"name="+name+", "+err.Error()) + result.Err = model.NewLocAppError("SqlChannelStore.GetByName", "store.sql_channel.get_by_name.existing.app_error", nil, "teamId="+teamId+", "+"name="+name+", "+err.Error()) } else { result.Data = &channel } @@ -461,14 +461,14 @@ func (s SqlChannelStore) SaveMember(member *model.ChannelMember) StoreChannel { channel := cr.Data.(*model.Channel) if transaction, err := s.GetMaster().Begin(); err != nil { - result.Err = model.NewAppError("SqlChannelStore.SaveMember", "Unable to open transaction", err.Error()) + result.Err = model.NewLocAppError("SqlChannelStore.SaveMember", "store.sql_channel.save_member.open_transaction.app_error", nil, err.Error()) } else { result = s.saveMemberT(transaction, member, channel) if result.Err != nil { transaction.Rollback() } else { if err := transaction.Commit(); err != nil { - result.Err = model.NewAppError("SqlChannelStore.SaveMember", "Unable to commit transaction", err.Error()) + result.Err = model.NewLocAppError("SqlChannelStore.SaveMember", "store.sql_channel.save_member.commit_transaction.app_error", nil, err.Error()) } // If sucessfull record members have changed in channel if mu := <-s.extraUpdated(channel); mu.Err != nil { @@ -495,9 +495,9 @@ func (s SqlChannelStore) saveMemberT(transaction *gorp.Transaction, member *mode if err := transaction.Insert(member); err != nil { if IsUniqueConstraintError(err.Error(), "ChannelId", "channelmembers_pkey") { - result.Err = model.NewAppError("SqlChannelStore.SaveMember", "A channel member with that id already exists", "channel_id="+member.ChannelId+", user_id="+member.UserId+", "+err.Error()) + result.Err = model.NewLocAppError("SqlChannelStore.SaveMember", "store.sql_channel.save_member.exists.app_error", nil, "channel_id="+member.ChannelId+", user_id="+member.UserId+", "+err.Error()) } else { - result.Err = model.NewAppError("SqlChannelStore.SaveMember", "We couldn't save the channel member", "channel_id="+member.ChannelId+", user_id="+member.UserId+", "+err.Error()) + result.Err = model.NewLocAppError("SqlChannelStore.SaveMember", "store.sql_channel.save_member.save.app_error", nil, "channel_id="+member.ChannelId+", user_id="+member.UserId+", "+err.Error()) } } else { result.Data = member @@ -521,7 +521,7 @@ func (s SqlChannelStore) UpdateMember(member *model.ChannelMember) StoreChannel } if _, err := s.GetMaster().Update(member); err != nil { - result.Err = model.NewAppError("SqlChannelStore.UpdateMember", "We encountered an error updating the channel member", + result.Err = model.NewLocAppError("SqlChannelStore.UpdateMember", "store.sql_channel.update_member.app_error", nil, "channel_id="+member.ChannelId+", "+"user_id="+member.UserId+", "+err.Error()) } else { result.Data = member @@ -543,7 +543,7 @@ func (s SqlChannelStore) GetMembers(channelId string) StoreChannel { var members []model.ChannelMember _, err := s.GetReplica().Select(&members, "SELECT * FROM ChannelMembers WHERE ChannelId = :ChannelId", map[string]interface{}{"ChannelId": channelId}) if err != nil { - result.Err = model.NewAppError("SqlChannelStore.GetMembers", "We couldn't get the channel members", "channel_id="+channelId+err.Error()) + result.Err = model.NewLocAppError("SqlChannelStore.GetMembers", "store.sql_channel.get_members.app_error", nil, "channel_id="+channelId+err.Error()) } else { result.Data = members } @@ -564,7 +564,7 @@ func (s SqlChannelStore) GetMember(channelId string, userId string) StoreChannel var member model.ChannelMember err := s.GetReplica().SelectOne(&member, "SELECT * FROM ChannelMembers WHERE ChannelId = :ChannelId AND UserId = :UserId", map[string]interface{}{"ChannelId": channelId, "UserId": userId}) if err != nil { - result.Err = model.NewAppError("SqlChannelStore.GetMember", "We couldn't get the channel member", "channel_id="+channelId+"user_id="+userId+","+err.Error()) + result.Err = model.NewLocAppError("SqlChannelStore.GetMember", "store.sql_channel.get_member.app_error", nil, "channel_id="+channelId+"user_id="+userId+","+err.Error()) } else { result.Data = member } @@ -593,7 +593,7 @@ func (s SqlChannelStore) GetMemberCount(channelId string) StoreChannel { 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()) + result.Err = model.NewLocAppError("SqlChannelStore.GetMemberCount", "store.sql_channel.get_member_count.app_error", nil, "channel_id="+channelId+", "+err.Error()) } else { result.Data = count } @@ -621,7 +621,7 @@ func (s SqlChannelStore) GetExtraMembers(channelId string, limit int) StoreChann } if err != nil { - result.Err = model.NewAppError("SqlChannelStore.GetExtraMembers", "We couldn't get the extra info for channel members", "channel_id="+channelId+", "+err.Error()) + result.Err = model.NewLocAppError("SqlChannelStore.GetExtraMembers", "store.sql_channel.get_extra_members.app_error", nil, "channel_id="+channelId+", "+err.Error()) } else { for i := range members { members[i].Sanitize(utils.Cfg.GetSanitizeOptions()) @@ -650,7 +650,7 @@ func (s SqlChannelStore) RemoveMember(channelId string, userId string) StoreChan _, err := s.GetMaster().Exec("DELETE FROM ChannelMembers WHERE ChannelId = :ChannelId AND UserId = :UserId", map[string]interface{}{"ChannelId": channelId, "UserId": userId}) if err != nil { - result.Err = model.NewAppError("SqlChannelStore.RemoveMember", "We couldn't remove the channel member", "channel_id="+channelId+", user_id="+userId+", "+err.Error()) + result.Err = model.NewLocAppError("SqlChannelStore.RemoveMember", "store.sql_channel.remove_member.app_error", nil, "channel_id="+channelId+", user_id="+userId+", "+err.Error()) } else { // If sucessfull record members have changed in channel if mu := <-s.extraUpdated(channel); mu.Err != nil { @@ -673,7 +673,7 @@ func (s SqlChannelStore) PermanentDeleteMembersByUser(userId string) StoreChanne result := StoreResult{} if _, err := s.GetMaster().Exec("DELETE FROM ChannelMembers WHERE UserId = :UserId", map[string]interface{}{"UserId": userId}); err != nil { - result.Err = model.NewAppError("SqlChannelStore.RemoveMember", "We couldn't remove the channel member", "user_id="+userId+", "+err.Error()) + result.Err = model.NewLocAppError("SqlChannelStore.RemoveMember", "store.sql_channel.permanent_delete_members_by_user.app_error", nil, "user_id="+userId+", "+err.Error()) } storeChannel <- result @@ -703,7 +703,7 @@ func (s SqlChannelStore) CheckPermissionsTo(teamId string, channelId string, use AND ChannelMembers.UserId = :UserId`, map[string]interface{}{"TeamId": teamId, "ChannelId": channelId, "UserId": userId}) if err != nil { - result.Err = model.NewAppError("SqlChannelStore.CheckPermissionsTo", "We couldn't check the permissions", "channel_id="+channelId+", user_id="+userId+", "+err.Error()) + result.Err = model.NewLocAppError("SqlChannelStore.CheckPermissionsTo", "store.sql_channel.check_permissions.app_error", nil, "channel_id="+channelId+", user_id="+userId+", "+err.Error()) } else { result.Data = count } @@ -735,7 +735,7 @@ func (s SqlChannelStore) CheckPermissionsToByName(teamId string, channelName str AND ChannelMembers.UserId = :UserId`, map[string]interface{}{"TeamId": teamId, "Name": channelName, "UserId": userId}) if err != nil { - result.Err = model.NewAppError("SqlChannelStore.CheckPermissionsToByName", "We couldn't check the permissions", "channel_id="+channelName+", user_id="+userId+", "+err.Error()) + result.Err = model.NewLocAppError("SqlChannelStore.CheckPermissionsToByName", "store.sql_channel.check_permissions_by_name.app_error", nil, "channel_id="+channelName+", user_id="+userId+", "+err.Error()) } else { result.Data = channelId } @@ -764,7 +764,7 @@ func (s SqlChannelStore) CheckOpenChannelPermissions(teamId string, channelId st AND Channels.Type = :ChannelType`, map[string]interface{}{"ChannelId": channelId, "TeamId": teamId, "ChannelType": model.CHANNEL_OPEN}) if err != nil { - result.Err = model.NewAppError("SqlChannelStore.CheckOpenChannelPermissions", "We couldn't check the permissions", "channel_id="+channelId+", "+err.Error()) + result.Err = model.NewLocAppError("SqlChannelStore.CheckOpenChannelPermissions", "store.sql_channel.check_open_channel_permissions.app_error", nil, "channel_id="+channelId+", "+err.Error()) } else { result.Data = count } @@ -814,7 +814,7 @@ func (s SqlChannelStore) UpdateLastViewedAt(channelId string, userId string) Sto _, err := s.GetMaster().Exec(query, map[string]interface{}{"ChannelId": channelId, "UserId": userId}) if err != nil { - result.Err = model.NewAppError("SqlChannelStore.UpdateLastViewedAt", "We couldn't update the last viewed at time", "channel_id="+channelId+", user_id="+userId+", "+err.Error()) + result.Err = model.NewLocAppError("SqlChannelStore.UpdateLastViewedAt", "store.sql_channel.update_last_viewed_at.app_error", nil, "channel_id="+channelId+", user_id="+userId+", "+err.Error()) } storeChannel <- result @@ -840,7 +840,7 @@ func (s SqlChannelStore) IncrementMentionCount(channelId string, userId string) AND ChannelId = :ChannelId`, map[string]interface{}{"ChannelId": channelId, "UserId": userId}) if err != nil { - result.Err = model.NewAppError("SqlChannelStore.IncrementMentionCount", "We couldn't increment the mention count", "channel_id="+channelId+", user_id="+userId+", "+err.Error()) + result.Err = model.NewLocAppError("SqlChannelStore.IncrementMentionCount", "store.sql_channel.increment_mention_count.app_error", nil, "channel_id="+channelId+", user_id="+userId+", "+err.Error()) } storeChannel <- result @@ -860,7 +860,7 @@ func (s SqlChannelStore) GetForExport(teamId string) StoreChannel { _, err := s.GetReplica().Select(&data, "SELECT * FROM Channels WHERE TeamId = :TeamId AND DeleteAt = 0 AND Type = 'O'", map[string]interface{}{"TeamId": teamId}) if err != nil { - result.Err = model.NewAppError("SqlChannelStore.GetAllChannels", "We couldn't get all the channels", "teamId="+teamId+", err="+err.Error()) + result.Err = model.NewLocAppError("SqlChannelStore.GetAllChannels", "store.sql_channel.get_for_export.app_error", nil, "teamId="+teamId+", err="+err.Error()) } else { result.Data = data } @@ -886,7 +886,7 @@ func (s SqlChannelStore) AnalyticsTypeCount(teamId string, channelType string) S v, err := s.GetReplica().SelectInt(query, map[string]interface{}{"TeamId": teamId, "ChannelType": channelType}) if err != nil { - result.Err = model.NewAppError("SqlChannelStore.AnalyticsTypeCount", "We couldn't get channel type counts", err.Error()) + result.Err = model.NewLocAppError("SqlChannelStore.AnalyticsTypeCount", "store.sql_channel.analytics_type_count.app_error", nil, err.Error()) } else { result.Data = v } diff --git a/store/sql_oauth_store.go b/store/sql_oauth_store.go index 43a5bee31..e41f584a6 100644 --- a/store/sql_oauth_store.go +++ b/store/sql_oauth_store.go @@ -60,7 +60,7 @@ func (as SqlOAuthStore) SaveApp(app *model.OAuthApp) StoreChannel { result := StoreResult{} if len(app.Id) > 0 { - result.Err = model.NewAppError("SqlOAuthStore.SaveApp", "Must call update for exisiting app", "app_id="+app.Id) + result.Err = model.NewLocAppError("SqlOAuthStore.SaveApp", "store.sql_oauth.save_app.existing.app_error", nil, "app_id="+app.Id) storeChannel <- result close(storeChannel) return @@ -74,7 +74,7 @@ func (as SqlOAuthStore) SaveApp(app *model.OAuthApp) StoreChannel { } if err := as.GetMaster().Insert(app); err != nil { - result.Err = model.NewAppError("SqlOAuthStore.SaveApp", "We couldn't save the app.", "app_id="+app.Id+", "+err.Error()) + result.Err = model.NewLocAppError("SqlOAuthStore.SaveApp", "store.sql_oauth.save_app.save.app_error", nil, "app_id="+app.Id+", "+err.Error()) } else { result.Data = app } @@ -102,9 +102,9 @@ func (as SqlOAuthStore) UpdateApp(app *model.OAuthApp) StoreChannel { } if oldAppResult, err := as.GetMaster().Get(model.OAuthApp{}, app.Id); err != nil { - result.Err = model.NewAppError("SqlOAuthStore.UpdateApp", "We encountered an error finding the app", "app_id="+app.Id+", "+err.Error()) + result.Err = model.NewLocAppError("SqlOAuthStore.UpdateApp", "store.sql_oauth.update_app.finding.app_error", nil, "app_id="+app.Id+", "+err.Error()) } else if oldAppResult == nil { - result.Err = model.NewAppError("SqlOAuthStore.UpdateApp", "We couldn't find the existing app to update", "app_id="+app.Id) + result.Err = model.NewLocAppError("SqlOAuthStore.UpdateApp", "store.sql_oauth.update_app.find.app_error", nil, "app_id="+app.Id) } else { oldApp := oldAppResult.(*model.OAuthApp) app.CreateAt = oldApp.CreateAt @@ -112,9 +112,9 @@ func (as SqlOAuthStore) UpdateApp(app *model.OAuthApp) StoreChannel { app.CreatorId = oldApp.CreatorId if count, err := as.GetMaster().Update(app); err != nil { - result.Err = model.NewAppError("SqlOAuthStore.UpdateApp", "We encountered an error updating the app", "app_id="+app.Id+", "+err.Error()) + result.Err = model.NewLocAppError("SqlOAuthStore.UpdateApp", "store.sql_oauth.update_app.updating.app_error", nil, "app_id="+app.Id+", "+err.Error()) } else if count != 1 { - result.Err = model.NewAppError("SqlOAuthStore.UpdateApp", "We couldn't update the app", "app_id="+app.Id) + result.Err = model.NewLocAppError("SqlOAuthStore.UpdateApp", "store.sql_oauth.update_app.update.app_error", nil, "app_id="+app.Id) } else { result.Data = [2]*model.OAuthApp{app, oldApp} } @@ -135,9 +135,9 @@ func (as SqlOAuthStore) GetApp(id string) StoreChannel { result := StoreResult{} if obj, err := as.GetReplica().Get(model.OAuthApp{}, id); err != nil { - result.Err = model.NewAppError("SqlOAuthStore.GetApp", "We encountered an error finding the app", "app_id="+id+", "+err.Error()) + result.Err = model.NewLocAppError("SqlOAuthStore.GetApp", "store.sql_oauth.get_app.finding.app_error", nil, "app_id="+id+", "+err.Error()) } else if obj == nil { - result.Err = model.NewAppError("SqlOAuthStore.GetApp", "We couldn't find the existing app", "app_id="+id) + result.Err = model.NewLocAppError("SqlOAuthStore.GetApp", "store.sql_oauth.get_app.find.app_error", nil, "app_id="+id) } else { result.Data = obj.(*model.OAuthApp) } @@ -160,7 +160,7 @@ func (as SqlOAuthStore) GetAppByUser(userId string) StoreChannel { var apps []*model.OAuthApp if _, err := as.GetReplica().Select(&apps, "SELECT * FROM OAuthApps WHERE CreatorId = :UserId", map[string]interface{}{"UserId": userId}); err != nil { - result.Err = model.NewAppError("SqlOAuthStore.GetAppByUser", "We couldn't find any existing apps", "user_id="+userId+", "+err.Error()) + result.Err = model.NewLocAppError("SqlOAuthStore.GetAppByUser", "store.sql_oauth.get_app_by_user.find.app_error", nil, "user_id="+userId+", "+err.Error()) } result.Data = apps @@ -186,7 +186,7 @@ func (as SqlOAuthStore) SaveAccessData(accessData *model.AccessData) StoreChanne } if err := as.GetMaster().Insert(accessData); err != nil { - result.Err = model.NewAppError("SqlOAuthStore.SaveAccessData", "We couldn't save the access token.", err.Error()) + result.Err = model.NewLocAppError("SqlOAuthStore.SaveAccessData", "store.sql_oauth.save_access_data.app_error", nil, err.Error()) } else { result.Data = accessData } @@ -208,7 +208,7 @@ func (as SqlOAuthStore) GetAccessData(token string) StoreChannel { accessData := model.AccessData{} if err := as.GetReplica().SelectOne(&accessData, "SELECT * FROM OAuthAccessData WHERE Token = :Token", map[string]interface{}{"Token": token}); err != nil { - result.Err = model.NewAppError("SqlOAuthStore.GetAccessData", "We encountered an error finding the access token", err.Error()) + result.Err = model.NewLocAppError("SqlOAuthStore.GetAccessData", "store.sql_oauth.get_access_data.app_error", nil, err.Error()) } else { result.Data = &accessData } @@ -234,7 +234,7 @@ func (as SqlOAuthStore) GetAccessDataByAuthCode(authCode string) StoreChannel { if strings.Contains(err.Error(), "no rows") { result.Data = nil } else { - result.Err = model.NewAppError("SqlOAuthStore.GetAccessDataByAuthCode", "We encountered an error finding the access token", err.Error()) + result.Err = model.NewLocAppError("SqlOAuthStore.GetAccessDataByAuthCode", "store.sql_oauth.get_access_data_by_code.app_error", nil, err.Error()) } } else { result.Data = &accessData @@ -255,7 +255,7 @@ func (as SqlOAuthStore) RemoveAccessData(token string) StoreChannel { result := StoreResult{} if _, err := as.GetMaster().Exec("DELETE FROM OAuthAccessData WHERE Token = :Token", map[string]interface{}{"Token": token}); err != nil { - result.Err = model.NewAppError("SqlOAuthStore.RemoveAccessData", "We couldn't remove the access token", "err="+err.Error()) + result.Err = model.NewLocAppError("SqlOAuthStore.RemoveAccessData", "store.sql_oauth.remove_access_data.app_error", nil, "err="+err.Error()) } storeChannel <- result @@ -280,7 +280,7 @@ func (as SqlOAuthStore) SaveAuthData(authData *model.AuthData) StoreChannel { } if err := as.GetMaster().Insert(authData); err != nil { - result.Err = model.NewAppError("SqlOAuthStore.SaveAuthData", "We couldn't save the authorization code.", err.Error()) + result.Err = model.NewLocAppError("SqlOAuthStore.SaveAuthData", "store.sql_oauth.save_auth_data.app_error", nil, err.Error()) } else { result.Data = authData } @@ -300,9 +300,9 @@ func (as SqlOAuthStore) GetAuthData(code string) StoreChannel { result := StoreResult{} if obj, err := as.GetReplica().Get(model.AuthData{}, code); err != nil { - result.Err = model.NewAppError("SqlOAuthStore.GetAuthData", "We encountered an error finding the authorization code", err.Error()) + result.Err = model.NewLocAppError("SqlOAuthStore.GetAuthData", "store.sql_oauth.get_auth_data.finding.app_error", nil, err.Error()) } else if obj == nil { - result.Err = model.NewAppError("SqlOAuthStore.GetAuthData", "We couldn't find the existing authorization code", "") + result.Err = model.NewLocAppError("SqlOAuthStore.GetAuthData", "store.sql_oauth.get_auth_data.find.app_error", nil, "") } else { result.Data = obj.(*model.AuthData) } @@ -323,7 +323,7 @@ func (as SqlOAuthStore) RemoveAuthData(code string) StoreChannel { _, err := as.GetMaster().Exec("DELETE FROM OAuthAuthData WHERE Code = :Code", map[string]interface{}{"Code": code}) if err != nil { - result.Err = model.NewAppError("SqlOAuthStore.RemoveAuthData", "We couldn't remove the authorization code", "err="+err.Error()) + result.Err = model.NewLocAppError("SqlOAuthStore.RemoveAuthData", "store.sql_oauth.remove_auth_data.app_error", nil, "err="+err.Error()) } storeChannel <- result @@ -341,7 +341,7 @@ func (as SqlOAuthStore) PermanentDeleteAuthDataByUser(userId string) StoreChanne _, err := as.GetMaster().Exec("DELETE FROM OAuthAuthData WHERE UserId = :UserId", map[string]interface{}{"UserId": userId}) if err != nil { - result.Err = model.NewAppError("SqlOAuthStore.RemoveAuthDataByUserId", "We couldn't remove the authorization code", "err="+err.Error()) + result.Err = model.NewLocAppError("SqlOAuthStore.RemoveAuthDataByUserId", "store.sql_oauth.permanent_delete_auth_data_by_user.app_error", nil, "err="+err.Error()) } storeChannel <- result diff --git a/store/sql_post_store.go b/store/sql_post_store.go index e332858e4..a2b18a163 100644 --- a/store/sql_post_store.go +++ b/store/sql_post_store.go @@ -57,8 +57,8 @@ func (s SqlPostStore) Save(post *model.Post) StoreChannel { result := StoreResult{} if len(post.Id) > 0 { - result.Err = model.NewAppError("SqlPostStore.Save", - "You cannot update an existing Post", "id="+post.Id) + result.Err = model.NewLocAppError("SqlPostStore.Save", + "store.sql_post.save.existing.app_error", nil, "id="+post.Id) storeChannel <- result close(storeChannel) return @@ -72,7 +72,7 @@ func (s SqlPostStore) Save(post *model.Post) StoreChannel { } if err := s.GetMaster().Insert(post); err != nil { - result.Err = model.NewAppError("SqlPostStore.Save", "We couldn't save the Post", "id="+post.Id+", "+err.Error()) + result.Err = model.NewLocAppError("SqlPostStore.Save", "store.sql_post.save.app_error", nil, "id="+post.Id+", "+err.Error()) } else { time := model.GetMillis() @@ -120,7 +120,7 @@ func (s SqlPostStore) Update(oldPost *model.Post, newMessage string, newHashtags } if _, err := s.GetMaster().Update(&editPost); err != nil { - result.Err = model.NewAppError("SqlPostStore.Update", "We couldn't update the Post", "id="+editPost.Id+", "+err.Error()) + result.Err = model.NewLocAppError("SqlPostStore.Update", "store.sql_post.update.app_error", nil, "id="+editPost.Id+", "+err.Error()) } else { time := model.GetMillis() s.GetMaster().Exec("UPDATE Channels SET LastPostAt = :LastPostAt WHERE Id = :ChannelId", map[string]interface{}{"LastPostAt": time, "ChannelId": editPost.ChannelId}) @@ -152,7 +152,7 @@ func (s SqlPostStore) Get(id string) StoreChannel { var post model.Post err := s.GetReplica().SelectOne(&post, "SELECT * FROM Posts WHERE Id = :Id AND DeleteAt = 0", map[string]interface{}{"Id": id}) if err != nil { - result.Err = model.NewAppError("SqlPostStore.GetPost", "We couldn't get the post", "id="+id+err.Error()) + result.Err = model.NewLocAppError("SqlPostStore.GetPost", "store.sql_post.get.app_error", nil, "id="+id+err.Error()) } pl.AddPost(&post) @@ -167,7 +167,7 @@ func (s SqlPostStore) Get(id string) StoreChannel { var posts []*model.Post _, err = s.GetReplica().Select(&posts, "SELECT * FROM Posts WHERE (Id = :Id OR RootId = :RootId) AND DeleteAt = 0", map[string]interface{}{"Id": rootId, "RootId": rootId}) if err != nil { - result.Err = model.NewAppError("SqlPostStore.GetPost", "We couldn't get the post", "root_id="+rootId+err.Error()) + result.Err = model.NewLocAppError("SqlPostStore.GetPost", "store.sql_post.get.app_error", nil, "root_id="+rootId+err.Error()) } else { for _, p := range posts { pl.AddPost(p) @@ -217,7 +217,7 @@ func (s SqlPostStore) Delete(postId string, time int64) StoreChannel { _, err := s.GetMaster().Exec("Update Posts SET DeleteAt = :DeleteAt, UpdateAt = :UpdateAt WHERE Id = :Id OR ParentId = :ParentId OR RootId = :RootId", map[string]interface{}{"DeleteAt": time, "UpdateAt": time, "Id": postId, "ParentId": postId, "RootId": postId}) if err != nil { - result.Err = model.NewAppError("SqlPostStore.Delete", "We couldn't delete the post", "id="+postId+", err="+err.Error()) + result.Err = model.NewLocAppError("SqlPostStore.Delete", "store.sql_post.delete.app_error", nil, "id="+postId+", err="+err.Error()) } storeChannel <- result @@ -235,7 +235,7 @@ func (s SqlPostStore) permanentDelete(postId string) StoreChannel { _, err := s.GetMaster().Exec("DELETE FROM Posts WHERE Id = :Id OR ParentId = :ParentId OR RootId = :RootId", map[string]interface{}{"Id": postId, "ParentId": postId, "RootId": postId}) if err != nil { - result.Err = model.NewAppError("SqlPostStore.Delete", "We couldn't delete the post", "id="+postId+", err="+err.Error()) + result.Err = model.NewLocAppError("SqlPostStore.Delete", "store.sql_post.permanent_delete.app_error", nil, "id="+postId+", err="+err.Error()) } storeChannel <- result @@ -253,7 +253,7 @@ func (s SqlPostStore) permanentDeleteAllCommentByUser(userId string) StoreChanne _, err := s.GetMaster().Exec("DELETE FROM Posts WHERE UserId = :UserId AND RootId != ''", map[string]interface{}{"UserId": userId}) if err != nil { - result.Err = model.NewAppError("SqlPostStore.permanentDeleteAllCommentByUser", "We couldn't delete the comments for user", "userId="+userId+", err="+err.Error()) + result.Err = model.NewLocAppError("SqlPostStore.permanentDeleteAllCommentByUser", "store.sql_post.permanent_delete_all_comments_by_user.app_error", nil, "userId="+userId+", err="+err.Error()) } storeChannel <- result @@ -286,7 +286,7 @@ func (s SqlPostStore) PermanentDeleteByUser(userId string) StoreChannel { var ids []string _, err := s.GetMaster().Select(&ids, "SELECT Id FROM Posts WHERE UserId = :UserId LIMIT 1000", map[string]interface{}{"UserId": userId}) if err != nil { - result.Err = model.NewAppError("SqlPostStore.PermanentDeleteByUser.select", "We couldn't select the posts to delete for the user", "userId="+userId+", err="+err.Error()) + result.Err = model.NewLocAppError("SqlPostStore.PermanentDeleteByUser.select", "store.sql_post.permanent_delete_by_user.app_error", nil, "userId="+userId+", err="+err.Error()) storeChannel <- result close(storeChannel) return @@ -306,7 +306,7 @@ func (s SqlPostStore) PermanentDeleteByUser(userId string) StoreChannel { // This is a fail safe, give up if more than 10K messages count = count + 1 if count >= 10 { - result.Err = model.NewAppError("SqlPostStore.PermanentDeleteByUser.toolarge", "We couldn't select the posts to delete for the user (too many), please re-run", "userId="+userId) + result.Err = model.NewLocAppError("SqlPostStore.PermanentDeleteByUser.toolarge", "store.sql_post.permanent_delete_by_user.too_many.app_error", nil, "userId="+userId) storeChannel <- result close(storeChannel) return @@ -327,7 +327,7 @@ func (s SqlPostStore) GetPosts(channelId string, offset int, limit int) StoreCha result := StoreResult{} if limit > 1000 { - result.Err = model.NewAppError("SqlPostStore.GetLinearPosts", "Limit exceeded for paging", "channelId="+channelId) + result.Err = model.NewLocAppError("SqlPostStore.GetLinearPosts", "store.sql_post.get_posts.app_error", nil, "channelId="+channelId) storeChannel <- result close(storeChannel) return @@ -403,7 +403,7 @@ func (s SqlPostStore) GetPostsSince(channelId string, time int64) StoreChannel { map[string]interface{}{"ChannelId": channelId, "Time": time}) if err != nil { - result.Err = model.NewAppError("SqlPostStore.GetPostsSince", "We couldn't get the posts for the channel", "channelId="+channelId+err.Error()) + result.Err = model.NewLocAppError("SqlPostStore.GetPostsSince", "store.sql_post.get_posts_since.app_error", nil, "channelId="+channelId+err.Error()) } else { list := &model.PostList{Order: make([]string, 0, len(posts))} @@ -488,9 +488,9 @@ func (s SqlPostStore) getPostsAround(channelId string, postId string, numPosts i map[string]interface{}{"ChannelId": channelId, "PostId": postId, "NumPosts": numPosts, "Offset": offset}) if err1 != nil { - result.Err = model.NewAppError("SqlPostStore.GetPostContext", "We couldn't get the posts for the channel", "channelId="+channelId+err1.Error()) + result.Err = model.NewLocAppError("SqlPostStore.GetPostContext", "store.sql_post.get_posts_around.get.app_error", nil, "channelId="+channelId+err1.Error()) } else if err2 != nil { - result.Err = model.NewAppError("SqlPostStore.GetPostContext", "We couldn't get the parent posts for the channel", "channelId="+channelId+err2.Error()) + result.Err = model.NewLocAppError("SqlPostStore.GetPostContext", "store.sql_post.get_posts_around.get_parent.app_error", nil, "channelId="+channelId+err2.Error()) } else { list := &model.PostList{Order: make([]string, 0, len(posts))} @@ -532,7 +532,7 @@ func (s SqlPostStore) getRootPosts(channelId string, offset int, limit int) Stor var posts []*model.Post _, err := s.GetReplica().Select(&posts, "SELECT * FROM Posts WHERE ChannelId = :ChannelId AND DeleteAt = 0 ORDER BY CreateAt DESC LIMIT :Limit OFFSET :Offset", map[string]interface{}{"ChannelId": channelId, "Offset": offset, "Limit": limit}) if err != nil { - result.Err = model.NewAppError("SqlPostStore.GetLinearPosts", "We couldn't get the posts for the channel", "channelId="+channelId+err.Error()) + result.Err = model.NewLocAppError("SqlPostStore.GetLinearPosts", "store.sql_post.get_root_posts.app_error", nil, "channelId="+channelId+err.Error()) } else { result.Data = posts } @@ -577,7 +577,7 @@ func (s SqlPostStore) getParentsPosts(channelId string, offset int, limit int) S ORDER BY CreateAt`, map[string]interface{}{"ChannelId1": channelId, "Offset": offset, "Limit": limit, "ChannelId2": channelId}) if err != nil { - result.Err = model.NewAppError("SqlPostStore.GetLinearPosts", "We couldn't get the parent post for the channel", "channelId="+channelId+err.Error()) + result.Err = model.NewLocAppError("SqlPostStore.GetLinearPosts", "store.sql_post.get_parents_posts.app_error", nil, "channelId="+channelId+err.Error()) } else { result.Data = posts } @@ -733,7 +733,7 @@ func (s SqlPostStore) Search(teamId string, userId string, params *model.SearchP _, err := s.GetReplica().Select(&posts, searchQuery, queryParams) if err != nil { - result.Err = model.NewAppError("SqlPostStore.Search", "We encountered an error while searching for posts", "teamId="+teamId+", err="+err.Error()) + result.Err = model.NewLocAppError("SqlPostStore.Search", "store.sql_post.search.app_error", nil, "teamId="+teamId+", err="+err.Error()) } list := &model.PostList{Order: make([]string, 0, len(posts))} @@ -777,7 +777,7 @@ func (s SqlPostStore) GetForExport(channelId string) StoreChannel { "SELECT * FROM Posts WHERE ChannelId = :ChannelId AND DeleteAt = 0", map[string]interface{}{"ChannelId": channelId}) if err != nil { - result.Err = model.NewAppError("SqlPostStore.GetForExport", "We couldn't get the posts for the channel", "channelId="+channelId+err.Error()) + result.Err = model.NewLocAppError("SqlPostStore.GetForExport", "store.sql_post.get_for_export.app_error", nil, "channelId="+channelId+err.Error()) } else { result.Data = posts } @@ -849,7 +849,7 @@ func (s SqlPostStore) AnalyticsUserCountsWithPostsByDay(teamId string) StoreChan query, map[string]interface{}{"TeamId": teamId, "EndTime": end}) if err != nil { - result.Err = model.NewAppError("SqlPostStore.AnalyticsUserCountsWithPostsByDay", "We couldn't get user counts with posts", err.Error()) + result.Err = model.NewLocAppError("SqlPostStore.AnalyticsUserCountsWithPostsByDay", "store.sql_post.analytics_user_counts_posts_by_day.app_error", nil, err.Error()) } else { result.Data = rows } @@ -922,7 +922,7 @@ func (s SqlPostStore) AnalyticsPostCountsByDay(teamId string) StoreChannel { query, map[string]interface{}{"TeamId": teamId, "StartTime": start, "EndTime": end}) if err != nil { - result.Err = model.NewAppError("SqlPostStore.AnalyticsPostCountsByDay", "We couldn't get post counts by day", err.Error()) + result.Err = model.NewLocAppError("SqlPostStore.AnalyticsPostCountsByDay", "store.sql_post.analytics_posts_count_by_day.app_error", nil, err.Error()) } else { result.Data = rows } @@ -955,7 +955,7 @@ func (s SqlPostStore) AnalyticsPostCount(teamId string) StoreChannel { v, err := s.GetReplica().SelectInt(query, map[string]interface{}{"TeamId": teamId}) if err != nil { - result.Err = model.NewAppError("SqlPostStore.AnalyticsPostCount", "We couldn't get post counts", err.Error()) + result.Err = model.NewLocAppError("SqlPostStore.AnalyticsPostCount", "store.sql_post.analytics_posts_count.app_error", nil, err.Error()) } else { result.Data = v } diff --git a/store/sql_preference_store.go b/store/sql_preference_store.go index 6302d2f4f..bb3fca3e3 100644 --- a/store/sql_preference_store.go +++ b/store/sql_preference_store.go @@ -42,7 +42,7 @@ func (s SqlPreferenceStore) CreateIndexesIfNotExists() { } func (s SqlPreferenceStore) DeleteUnusedFeatures() { - l4g.Debug("Deleting any unused pre-release features") + l4g.Debug(utils.T("store.sql_preference.delete_unused_features.debug")) sql := `DELETE FROM Preferences @@ -67,7 +67,7 @@ func (s SqlPreferenceStore) Save(preferences *model.Preferences) StoreChannel { // wrap in a transaction so that if one fails, everything fails transaction, err := s.GetMaster().Begin() if err != nil { - result.Err = model.NewAppError("SqlPreferenceStore.Save", "Unable to open transaction to save preferences", err.Error()) + result.Err = model.NewLocAppError("SqlPreferenceStore.Save", "store.sql_preference.save.open_transaction.app_error", nil, err.Error()) } else { for _, preference := range *preferences { if upsertResult := s.save(transaction, &preference); upsertResult.Err != nil { @@ -79,13 +79,13 @@ func (s SqlPreferenceStore) Save(preferences *model.Preferences) StoreChannel { if result.Err == nil { if err := transaction.Commit(); err != nil { // don't need to rollback here since the transaction is already closed - result.Err = model.NewAppError("SqlPreferenceStore.Save", "Unable to commit transaction to save preferences", err.Error()) + result.Err = model.NewLocAppError("SqlPreferenceStore.Save", "store.sql_preference.save.commit_transaction.app_error", nil, err.Error()) } else { result.Data = len(*preferences) } } else { if err := transaction.Rollback(); err != nil { - result.Err = model.NewAppError("SqlPreferenceStore.Save", "Unable to rollback transaction to save preferences", err.Error()) + result.Err = model.NewLocAppError("SqlPreferenceStore.Save", "store.sql_preference.save.rollback_transaction.app_error", nil, err.Error()) } } } @@ -120,7 +120,7 @@ func (s SqlPreferenceStore) save(transaction *gorp.Transaction, preference *mode (:UserId, :Category, :Name, :Value) ON DUPLICATE KEY UPDATE Value = :Value`, params); err != nil { - result.Err = model.NewAppError("SqlPreferenceStore.save", "We encountered an error while updating preferences", err.Error()) + result.Err = model.NewLocAppError("SqlPreferenceStore.save", "store.sql_preference.save.updating.app_error", nil, err.Error()) } } else if utils.Cfg.SqlSettings.DriverName == model.DATABASE_DRIVER_POSTGRES { // postgres has no way to upsert values until version 9.5 and trying inserting and then updating causes transactions to abort @@ -134,7 +134,7 @@ func (s SqlPreferenceStore) save(transaction *gorp.Transaction, preference *mode AND Category = :Category AND Name = :Name`, params) if err != nil { - result.Err = model.NewAppError("SqlPreferenceStore.save", "We encountered an error while updating preferences", err.Error()) + result.Err = model.NewLocAppError("SqlPreferenceStore.save", "store.sql_preference.save.updating.app_error", nil, err.Error()) return result } @@ -144,7 +144,7 @@ func (s SqlPreferenceStore) save(transaction *gorp.Transaction, preference *mode s.insert(transaction, preference) } } else { - result.Err = model.NewAppError("SqlPreferenceStore.save", "We encountered an error while updating preferences", + result.Err = model.NewLocAppError("SqlPreferenceStore.save", "store.sql_preference.save.missing_driver.app_error", nil, "Failed to update preference because of missing driver") } @@ -156,10 +156,10 @@ func (s SqlPreferenceStore) insert(transaction *gorp.Transaction, preference *mo if err := transaction.Insert(preference); err != nil { if IsUniqueConstraintError(err.Error(), "UserId", "preferences_pkey") { - result.Err = model.NewAppError("SqlPreferenceStore.insert", "A preference with that user id, category, and name already exists", + result.Err = model.NewLocAppError("SqlPreferenceStore.insert", "store.sql_preference.insert.exists.app_error", nil, "user_id="+preference.UserId+", category="+preference.Category+", name="+preference.Name+", "+err.Error()) } else { - result.Err = model.NewAppError("SqlPreferenceStore.insert", "We couldn't save the preference", + result.Err = model.NewLocAppError("SqlPreferenceStore.insert", "store.sql_preference.insert.save.app_error", nil, "user_id="+preference.UserId+", category="+preference.Category+", name="+preference.Name+", "+err.Error()) } } @@ -171,7 +171,7 @@ func (s SqlPreferenceStore) update(transaction *gorp.Transaction, preference *mo result := StoreResult{} if _, err := transaction.Update(preference); err != nil { - result.Err = model.NewAppError("SqlPreferenceStore.update", "We couldn't update the preference", + result.Err = model.NewLocAppError("SqlPreferenceStore.update", "store.sql_preference.update.app_error", nil, "user_id="+preference.UserId+", category="+preference.Category+", name="+preference.Name+", "+err.Error()) } @@ -195,7 +195,7 @@ func (s SqlPreferenceStore) Get(userId string, category string, name string) Sto UserId = :UserId AND Category = :Category AND Name = :Name`, map[string]interface{}{"UserId": userId, "Category": category, "Name": name}); err != nil { - result.Err = model.NewAppError("SqlPreferenceStore.Get", "We encountered an error while finding preferences", err.Error()) + result.Err = model.NewLocAppError("SqlPreferenceStore.Get", "store.sql_preference.get.app_error", nil, err.Error()) } else { result.Data = preference } @@ -223,7 +223,7 @@ func (s SqlPreferenceStore) GetCategory(userId string, category string) StoreCha WHERE UserId = :UserId AND Category = :Category`, map[string]interface{}{"UserId": userId, "Category": category}); err != nil { - result.Err = model.NewAppError("SqlPreferenceStore.GetCategory", "We encountered an error while finding preferences", err.Error()) + result.Err = model.NewLocAppError("SqlPreferenceStore.GetCategory", "store.sql_preference.get_category.app_error", nil, err.Error()) } else { result.Data = preferences } @@ -250,7 +250,7 @@ func (s SqlPreferenceStore) GetAll(userId string) StoreChannel { Preferences WHERE UserId = :UserId`, map[string]interface{}{"UserId": userId}); err != nil { - result.Err = model.NewAppError("SqlPreferenceStore.GetAll", "We encountered an error while finding preferences", err.Error()) + result.Err = model.NewLocAppError("SqlPreferenceStore.GetAll", "store.sql_preference.get_all.app_error", nil, err.Error()) } else { result.Data = preferences } @@ -270,7 +270,7 @@ func (s SqlPreferenceStore) PermanentDeleteByUser(userId string) StoreChannel { if _, err := s.GetMaster().Exec( `DELETE FROM Preferences WHERE UserId = :UserId`, map[string]interface{}{"UserId": userId}); err != nil { - result.Err = model.NewAppError("SqlPreferenceStore.Delete", "We encountered an error while deleteing preferences", err.Error()) + result.Err = model.NewLocAppError("SqlPreferenceStore.Delete", "store.sql_preference.permanent_delete_by_user.app_error", nil, err.Error()) } storeChannel <- result @@ -293,7 +293,7 @@ func (s SqlPreferenceStore) IsFeatureEnabled(feature, userId string) StoreChanne UserId = :UserId AND Category = :Category AND Name = :Name`, map[string]interface{}{"UserId": userId, "Category": model.PREFERENCE_CATEGORY_ADVANCED_SETTINGS, "Name": FEATURE_TOGGLE_PREFIX + feature}); err != nil { - result.Err = model.NewAppError("SqlPreferenceStore.IsFeatureEnabled", "We encountered an error while finding a pre release feature preference", err.Error()) + result.Err = model.NewLocAppError("SqlPreferenceStore.IsFeatureEnabled", "store.sql_preference.is_feature_enabled.app_error", nil, err.Error()) } else { result.Data = value == "true" } diff --git a/store/sql_session_store.go b/store/sql_session_store.go index 6b0a31443..4762a1dfd 100644 --- a/store/sql_session_store.go +++ b/store/sql_session_store.go @@ -6,6 +6,7 @@ package store import ( l4g "github.com/alecthomas/log4go" "github.com/mattermost/platform/model" + "github.com/mattermost/platform/utils" ) type SqlSessionStore struct { @@ -45,7 +46,7 @@ func (me SqlSessionStore) Save(session *model.Session) StoreChannel { result := StoreResult{} if len(session.Id) > 0 { - result.Err = model.NewAppError("SqlSessionStore.Save", "Cannot update existing session", "id="+session.Id) + result.Err = model.NewLocAppError("SqlSessionStore.Save", "store.sql_session.save.existing.app_error", nil, "id="+session.Id) storeChannel <- result close(storeChannel) return @@ -54,11 +55,11 @@ func (me SqlSessionStore) Save(session *model.Session) StoreChannel { session.PreSave() if cur := <-me.CleanUpExpiredSessions(session.UserId); cur.Err != nil { - l4g.Error("Failed to cleanup sessions in Save err=%v", cur.Err) + l4g.Error(utils.T("store.sql_session.save.cleanup.error"), cur.Err) } if err := me.GetMaster().Insert(session); err != nil { - result.Err = model.NewAppError("SqlSessionStore.Save", "We couldn't save the session", "id="+session.Id+", "+err.Error()) + result.Err = model.NewLocAppError("SqlSessionStore.Save", "store.sql_session.save.app_error", nil, "id="+session.Id+", "+err.Error()) } else { result.Data = session } @@ -80,9 +81,9 @@ func (me SqlSessionStore) Get(sessionIdOrToken string) StoreChannel { var sessions []*model.Session if _, err := me.GetReplica().Select(&sessions, "SELECT * FROM Sessions WHERE Token = :Token OR Id = :Id LIMIT 1", map[string]interface{}{"Token": sessionIdOrToken, "Id": sessionIdOrToken}); err != nil { - result.Err = model.NewAppError("SqlSessionStore.Get", "We encountered an error finding the session", "sessionIdOrToken="+sessionIdOrToken+", "+err.Error()) + result.Err = model.NewLocAppError("SqlSessionStore.Get", "store.sql_session.get.app_error", nil, "sessionIdOrToken="+sessionIdOrToken+", "+err.Error()) } else if sessions == nil || len(sessions) == 0 { - result.Err = model.NewAppError("SqlSessionStore.Get", "We encountered an error finding the session", "sessionIdOrToken="+sessionIdOrToken) + result.Err = model.NewLocAppError("SqlSessionStore.Get", "store.sql_session.get.app_error", nil, "sessionIdOrToken="+sessionIdOrToken) } else { result.Data = sessions[0] } @@ -101,7 +102,7 @@ func (me SqlSessionStore) GetSessions(userId string) StoreChannel { go func() { if cur := <-me.CleanUpExpiredSessions(userId); cur.Err != nil { - l4g.Error("Failed to cleanup sessions in getSessions err=%v", cur.Err) + l4g.Error(utils.T("store.sql_session.get_sessions.error"), cur.Err) } result := StoreResult{} @@ -109,7 +110,7 @@ func (me SqlSessionStore) GetSessions(userId string) StoreChannel { var sessions []*model.Session if _, err := me.GetReplica().Select(&sessions, "SELECT * FROM Sessions WHERE UserId = :UserId ORDER BY LastActivityAt DESC", map[string]interface{}{"UserId": userId}); err != nil { - result.Err = model.NewAppError("SqlSessionStore.GetSessions", "We encountered an error while finding user sessions", err.Error()) + result.Err = model.NewLocAppError("SqlSessionStore.GetSessions", "store.sql_session.get_sessions.app_error", nil, err.Error()) } else { result.Data = sessions @@ -130,7 +131,7 @@ func (me SqlSessionStore) Remove(sessionIdOrToken string) StoreChannel { _, err := me.GetMaster().Exec("DELETE FROM Sessions WHERE Id = :Id Or Token = :Token", map[string]interface{}{"Id": sessionIdOrToken, "Token": sessionIdOrToken}) if err != nil { - result.Err = model.NewAppError("SqlSessionStore.RemoveSession", "We couldn't remove the session", "id="+sessionIdOrToken+", err="+err.Error()) + result.Err = model.NewLocAppError("SqlSessionStore.RemoveSession", "store.sql_session.remove.app_error", nil, "id="+sessionIdOrToken+", err="+err.Error()) } storeChannel <- result @@ -148,7 +149,7 @@ func (me SqlSessionStore) RemoveAllSessionsForTeam(teamId string) StoreChannel { _, err := me.GetMaster().Exec("DELETE FROM Sessions WHERE TeamId = :TeamId", map[string]interface{}{"TeamId": teamId}) if err != nil { - result.Err = model.NewAppError("SqlSessionStore.RemoveAllSessionsForTeam", "We couldn't remove all the sessions for the team", "id="+teamId+", err="+err.Error()) + result.Err = model.NewLocAppError("SqlSessionStore.RemoveAllSessionsForTeam", "store.sql_session.remove_all_sessions_for_team.app_error", nil, "id="+teamId+", err="+err.Error()) } storeChannel <- result @@ -166,7 +167,7 @@ func (me SqlSessionStore) PermanentDeleteSessionsByUser(userId string) StoreChan _, err := me.GetMaster().Exec("DELETE FROM Sessions WHERE UserId = :UserId", map[string]interface{}{"UserId": userId}) if err != nil { - result.Err = model.NewAppError("SqlSessionStore.RemoveAllSessionsForUser", "We couldn't remove all the sessions for the user", "id="+userId+", err="+err.Error()) + result.Err = model.NewLocAppError("SqlSessionStore.RemoveAllSessionsForUser", "store.sql_session.permanent_delete_sessions_by_user.app_error", nil, "id="+userId+", err="+err.Error()) } storeChannel <- result @@ -183,7 +184,7 @@ func (me SqlSessionStore) CleanUpExpiredSessions(userId string) StoreChannel { result := StoreResult{} if _, err := me.GetMaster().Exec("DELETE FROM Sessions WHERE UserId = :UserId AND ExpiresAt != 0 AND :ExpiresAt > ExpiresAt", map[string]interface{}{"UserId": userId, "ExpiresAt": model.GetMillis()}); err != nil { - result.Err = model.NewAppError("SqlSessionStore.CleanUpExpiredSessions", "We encountered an error while deleting expired user sessions", err.Error()) + result.Err = model.NewLocAppError("SqlSessionStore.CleanUpExpiredSessions", "store.sql_session.cleanup_expired_sessions.app_error", nil, err.Error()) } else { result.Data = userId } @@ -202,7 +203,7 @@ func (me SqlSessionStore) UpdateLastActivityAt(sessionId string, time int64) Sto result := StoreResult{} if _, err := me.GetMaster().Exec("UPDATE Sessions SET LastActivityAt = :LastActivityAt WHERE Id = :Id", map[string]interface{}{"LastActivityAt": time, "Id": sessionId}); err != nil { - result.Err = model.NewAppError("SqlSessionStore.UpdateLastActivityAt", "We couldn't update the last_activity_at", "sessionId="+sessionId) + result.Err = model.NewLocAppError("SqlSessionStore.UpdateLastActivityAt", "store.sql_session.update_last_activity.app_error", nil, "sessionId="+sessionId) } else { result.Data = sessionId } @@ -220,7 +221,7 @@ func (me SqlSessionStore) UpdateRoles(userId, roles string) StoreChannel { go func() { result := StoreResult{} if _, err := me.GetMaster().Exec("UPDATE Sessions SET Roles = :Roles WHERE UserId = :UserId", map[string]interface{}{"Roles": roles, "UserId": userId}); err != nil { - result.Err = model.NewAppError("SqlSessionStore.UpdateRoles", "We couldn't update the roles", "userId="+userId) + result.Err = model.NewLocAppError("SqlSessionStore.UpdateRoles", "store.sql_session.update_roles.app_error", nil, "userId="+userId) } else { result.Data = userId } diff --git a/store/sql_store.go b/store/sql_store.go index d0471fa1e..e4e1bf3b4 100644 --- a/store/sql_store.go +++ b/store/sql_store.go @@ -92,13 +92,13 @@ func NewSqlStore() Store { } if model.IsPreviousVersion(schemaVersion) || isSchemaVersion07 || isSchemaVersion10 { - l4g.Warn("The database schema version of " + schemaVersion + " appears to be out of date") - l4g.Warn("Attempting to upgrade the database schema version to " + model.CurrentVersion) + l4g.Warn(utils.T("store.sql.schema_out_of_date.warn"), schemaVersion) + l4g.Warn(utils.T("store.sql.schema_upgrade_attempt.warn"), model.CurrentVersion) } else { // If this is an 'upgrade needed' state but the user is attempting to skip a version then halt the world - l4g.Critical("The database schema version of " + schemaVersion + " cannot be upgraded. You must not skip a version.") + l4g.Critical(utils.T("store.sql.schema_version.critical"), schemaVersion) time.Sleep(time.Second) - panic("The database schema version of " + schemaVersion + " cannot be upgraded. You must not skip a version.") + panic(fmt.Sprintf(utils.T("store.sql.schema_version.critical"), schemaVersion)) } } } @@ -123,7 +123,7 @@ func NewSqlStore() Store { err := sqlStore.master.CreateTablesIfNotExists() if err != nil { - l4g.Critical("Error creating database tables: %v", err) + l4g.Critical(utils.T("store.sql.creating_tables.critical"), err) } sqlStore.team.(*SqlTeamStore).UpgradeSchemaIfNeeded() @@ -152,12 +152,12 @@ func NewSqlStore() Store { if model.IsPreviousVersion(schemaVersion) || isSchemaVersion07 || isSchemaVersion10 { sqlStore.system.Update(&model.System{Name: "Version", Value: model.CurrentVersion}) - l4g.Warn("The database schema has been upgraded to version " + model.CurrentVersion) + l4g.Warn(utils.T("store.sql.upgraded.warn"), model.CurrentVersion) } if schemaVersion == "" { sqlStore.system.Save(&model.System{Name: "Version", Value: model.CurrentVersion}) - l4g.Info("The database schema has been set to version " + model.CurrentVersion) + l4g.Info(utils.T("store.sql.schema_set.info"), model.CurrentVersion) } return sqlStore @@ -167,17 +167,17 @@ func setupConnection(con_type string, driver string, dataSource string, maxIdle db, err := dbsql.Open(driver, dataSource) if err != nil { - l4g.Critical("Failed to open sql connection to err:%v", err) + l4g.Critical(utils.T("store.sql.open_conn.critical"), err) time.Sleep(time.Second) - panic("Failed to open sql connection" + err.Error()) + panic(fmt.Sprintf(utils.T("store.sql.open_conn.critical"), err.Error())) } - l4g.Info("Pinging sql %v database", con_type) + l4g.Info(utils.T("store.sql.pinging.info"), con_type) err = db.Ping() if err != nil { - l4g.Critical("Failed to ping db err:%v", err) + l4g.Critical(utils.T("store.sql.ping.critical"), err) time.Sleep(time.Second) - panic("Failed to open sql connection " + err.Error()) + panic(fmt.Sprintf(utils.T("store.sql.open_conn.panic"), err.Error())) } db.SetMaxIdleConns(maxIdle) @@ -192,9 +192,9 @@ func setupConnection(con_type string, driver string, dataSource string, maxIdle } else if driver == model.DATABASE_DRIVER_POSTGRES { dbmap = &gorp.DbMap{Db: db, TypeConverter: mattermConverter{}, Dialect: gorp.PostgresDialect{}} } else { - l4g.Critical("Failed to create dialect specific driver") + l4g.Critical(utils.T("store.sql.dialect_driver.critical")) time.Sleep(time.Second) - panic("Failed to create dialect specific driver " + err.Error()) + panic(fmt.Sprintf(utils.T("store.sql.dialect_driver.panic"), err.Error())) } if trace { @@ -228,9 +228,9 @@ func (ss SqlStore) DoesTableExist(tableName string) bool { ) if err != nil { - l4g.Critical("Failed to check if table exists %v", err) + l4g.Critical(utils.T("store.sql.table_exists.critical"), err) time.Sleep(time.Second) - panic("Failed to check if table exists " + err.Error()) + panic(fmt.Sprintf(utils.T("store.sql.table_exists.critical"), err.Error())) } return count > 0 @@ -250,17 +250,17 @@ func (ss SqlStore) DoesTableExist(tableName string) bool { ) if err != nil { - l4g.Critical("Failed to check if table exists %v", err) + l4g.Critical(utils.T("store.sql.table_exists.critical"), err) time.Sleep(time.Second) - panic("Failed to check if table exists " + err.Error()) + panic(fmt.Sprintf(utils.T("store.sql.table_exists.critical"), err.Error())) } return count > 0 } else { - l4g.Critical("Failed to check if column exists because of missing driver") + l4g.Critical(utils.T("store.sql.column_exists_missing_driver.critical")) time.Sleep(time.Second) - panic("Failed to check if column exists because of missing driver") + panic(utils.T("store.sql.column_exists_missing_driver.critical")) } } @@ -282,9 +282,9 @@ func (ss SqlStore) DoesColumnExist(tableName string, columnName string) bool { return false } - l4g.Critical("Failed to check if column exists %v", err) + l4g.Critical(utils.T("store.sql.column_exists.critical"), err) time.Sleep(time.Second) - panic("Failed to check if column exists " + err.Error()) + panic(fmt.Sprintf(utils.T("store.sql.column_exists.critical"), err.Error())) } return count > 0 @@ -305,17 +305,17 @@ func (ss SqlStore) DoesColumnExist(tableName string, columnName string) bool { ) if err != nil { - l4g.Critical("Failed to check if column exists %v", err) + l4g.Critical(utils.T("store.sql.column_exists.critical"), err) time.Sleep(time.Second) - panic("Failed to check if column exists " + err.Error()) + panic(fmt.Sprintf(utils.T("store.sql.column_exists.critical"), err.Error())) } return count > 0 } else { - l4g.Critical("Failed to check if column exists because of missing driver") + l4g.Critical(utils.T("store.sql.column_exists_missing_driver.critical")) time.Sleep(time.Second) - panic("Failed to check if column exists because of missing driver") + panic(utils.T("store.sql.column_exists_missing_driver.critical")) } } @@ -329,9 +329,9 @@ func (ss SqlStore) CreateColumnIfNotExists(tableName string, columnName string, if utils.Cfg.SqlSettings.DriverName == model.DATABASE_DRIVER_POSTGRES { _, err := ss.GetMaster().Exec("ALTER TABLE " + tableName + " ADD " + columnName + " " + postgresColType + " DEFAULT '" + defaultValue + "'") if err != nil { - l4g.Critical("Failed to create column %v", err) + l4g.Critical(utils.T("store.sql.create_column.critical"), err) time.Sleep(time.Second) - panic("Failed to create column " + err.Error()) + panic(fmt.Sprintf(utils.T("store.sql.create_column.critical"), err.Error())) } return true @@ -339,17 +339,17 @@ func (ss SqlStore) CreateColumnIfNotExists(tableName string, columnName string, } else if utils.Cfg.SqlSettings.DriverName == model.DATABASE_DRIVER_MYSQL { _, err := ss.GetMaster().Exec("ALTER TABLE " + tableName + " ADD " + columnName + " " + mySqlColType + " DEFAULT '" + defaultValue + "'") if err != nil { - l4g.Critical("Failed to create column %v", err) + l4g.Critical(utils.T("store.sql.create_column.critical"), err) time.Sleep(time.Second) - panic("Failed to create column " + err.Error()) + panic(fmt.Sprintf(utils.T("store.sql.create_column.critical"), err.Error())) } return true } else { - l4g.Critical("Failed to create column because of missing driver") + l4g.Critical(utils.T("store.sql.create_column_missing_driver.critical")) time.Sleep(time.Second) - panic("Failed to create column because of missing driver") + panic(utils.T("store.sql.create_column_missing_driver.critical")) } } @@ -361,9 +361,9 @@ func (ss SqlStore) RemoveColumnIfExists(tableName string, columnName string) boo _, err := ss.GetMaster().Exec("ALTER TABLE " + tableName + " DROP COLUMN " + columnName) if err != nil { - l4g.Critical("Failed to drop column %v", err) + l4g.Critical(utils.T("store.sql.drop_column.critical"), err) time.Sleep(time.Second) - panic("Failed to drop column " + err.Error()) + panic(fmt.Sprintf(utils.T("store.sql.drop_column.critical"), err.Error())) } return true @@ -382,9 +382,9 @@ func (ss SqlStore) RenameColumnIfExists(tableName string, oldColumnName string, } if err != nil { - l4g.Critical("Failed to rename column %v", err) + l4g.Critical(utils.T("store.sql.rename_column.critical"), err) time.Sleep(time.Second) - panic("Failed to drop column " + err.Error()) + panic(fmt.Sprintf(utils.T("store.sql.rename_column.critical"), err.Error())) } return true @@ -416,17 +416,17 @@ func (ss SqlStore) createIndexIfNotExists(indexName string, tableName string, co _, err = ss.GetMaster().Exec(query) if err != nil { - l4g.Critical("Failed to create index %v", err) + l4g.Critical(utils.T("store.sql.create_index.critical"), err) time.Sleep(time.Second) - panic("Failed to create index " + err.Error()) + panic(fmt.Sprintf(utils.T("store.sql.create_index.critical"), err.Error())) } } else if utils.Cfg.SqlSettings.DriverName == model.DATABASE_DRIVER_MYSQL { count, err := ss.GetMaster().SelectInt("SELECT COUNT(0) AS index_exists FROM information_schema.statistics WHERE TABLE_SCHEMA = DATABASE() and table_name = ? AND index_name = ?", tableName, indexName) if err != nil { - l4g.Critical("Failed to check index %v", err) + l4g.Critical(utils.T("store.sql.check_index.critical"), err) time.Sleep(time.Second) - panic("Failed to check index " + err.Error()) + panic(fmt.Sprintf(utils.T("store.sql.check_index.critical"), err.Error())) } if count > 0 { @@ -440,14 +440,14 @@ func (ss SqlStore) createIndexIfNotExists(indexName string, tableName string, co _, err = ss.GetMaster().Exec("CREATE " + fullTextIndex + " INDEX " + indexName + " ON " + tableName + " (" + columnName + ")") if err != nil { - l4g.Critical("Failed to create index %v", err) + l4g.Critical(utils.T("store.sql.create_index.critical"), err) time.Sleep(time.Second) - panic("Failed to create index " + err.Error()) + panic(fmt.Sprintf(utils.T("store.sql.create_index.critical"), err.Error())) } } else { - l4g.Critical("Failed to create index because of missing driver") + l4g.Critical(utils.T("store.sql.create_index_missing_driver.critical")) time.Sleep(time.Second) - panic("Failed to create index because of missing driver") + panic(utils.T("store.sql.create_index_missing_driver.critical")) } } @@ -463,9 +463,9 @@ func (ss SqlStore) GetColumnDataType(tableName, columnName string) string { "Columnname": columnName, }) if err != nil { - l4g.Critical("Failed to get data type for column %s from table %s: %v", columnName, tableName, err.Error()) + l4g.Critical(utils.T("store.sql.table_column_type.critical"), columnName, tableName, err.Error()) time.Sleep(time.Second) - panic("Failed to get get data type for column " + columnName + " from table " + tableName + ": " + err.Error()) + panic(fmt.Sprintf(utils.T("store.sql.table_column_type.critical"), columnName, tableName, err.Error())) } return dataType @@ -487,7 +487,7 @@ func (ss SqlStore) GetAllConns() []*gorp.DbMap { } func (ss SqlStore) Close() { - l4g.Info("Closing SqlStore") + l4g.Info(utils.T("store.sql.closing.info")) ss.master.Db.Close() for _, replica := range ss.replicas { replica.Db.Close() @@ -558,7 +558,7 @@ func (me mattermConverter) FromDb(target interface{}) (gorp.CustomScanner, bool) binder := func(holder, target interface{}) error { s, ok := holder.(*string) if !ok { - return errors.New("FromDb: Unable to convert StringMap to *string") + return errors.New(utils.T("store.sql.convert_string_map")) } b := []byte(*s) return json.Unmarshal(b, target) @@ -568,7 +568,7 @@ func (me mattermConverter) FromDb(target interface{}) (gorp.CustomScanner, bool) binder := func(holder, target interface{}) error { s, ok := holder.(*string) if !ok { - return errors.New("FromDb: Unable to convert StringArray to *string") + return errors.New(utils.T("store.sql.convert_string_array")) } b := []byte(*s) return json.Unmarshal(b, target) @@ -578,7 +578,7 @@ func (me mattermConverter) FromDb(target interface{}) (gorp.CustomScanner, bool) binder := func(holder, target interface{}) error { s, ok := holder.(*string) if !ok { - return errors.New("FromDb: Unable to convert EncryptStringMap to *string") + return errors.New(utils.T("store.sql.convert_encrypt_string_map")) } ue, err := decrypt([]byte(utils.Cfg.SqlSettings.AtRestEncryptKey), *s) @@ -594,7 +594,7 @@ func (me mattermConverter) FromDb(target interface{}) (gorp.CustomScanner, bool) binder := func(holder, target interface{}) error { s, ok := holder.(*string) if !ok { - return errors.New("FromDb: Unable to convert StringInterface to *string") + return errors.New(utils.T("store.sql.convert_string_interface")) } b := []byte(*s) return json.Unmarshal(b, target) @@ -651,14 +651,14 @@ func decrypt(key []byte, cryptoText string) (string, error) { ekey, akey := skey[:32], skey[32:] macfn := hmac.New(sha256.New, akey) if len(ciphertext) < aes.BlockSize+macfn.Size() { - return "", errors.New("short ciphertext") + return "", errors.New(utils.T("store.sql.short_ciphertext")) } macfn.Write(ciphertext[aes.BlockSize+macfn.Size():]) expectedMac := macfn.Sum(nil) mac := ciphertext[aes.BlockSize : aes.BlockSize+macfn.Size()] if hmac.Equal(expectedMac, mac) != true { - return "", errors.New("Incorrect MAC for the given ciphertext") + return "", errors.New(utils.T("store.sql.incorrect_mac")) } block, err := aes.NewCipher(ekey) @@ -667,7 +667,7 @@ func decrypt(key []byte, cryptoText string) (string, error) { } if len(ciphertext) < aes.BlockSize { - return "", errors.New("ciphertext too short") + return "", errors.New(utils.T("store.sql.too_short_ciphertext")) } iv := ciphertext[:aes.BlockSize] ciphertext = ciphertext[aes.BlockSize+macfn.Size():] diff --git a/store/sql_store_test.go b/store/sql_store_test.go index 1e04b676c..1be87dec9 100644 --- a/store/sql_store_test.go +++ b/store/sql_store_test.go @@ -16,6 +16,7 @@ var store Store func Setup() { if store == nil { utils.LoadConfig("config.json") + utils.InitTranslations() store = NewSqlStore() store.MarkSystemRanUnitTests() diff --git a/store/sql_system_store.go b/store/sql_system_store.go index 1fbdfb333..cfd4a670f 100644 --- a/store/sql_system_store.go +++ b/store/sql_system_store.go @@ -37,7 +37,7 @@ func (s SqlSystemStore) Save(system *model.System) StoreChannel { result := StoreResult{} if err := s.GetMaster().Insert(system); err != nil { - result.Err = model.NewAppError("SqlSystemStore.Save", "We encountered an error saving the system property", "") + result.Err = model.NewLocAppError("SqlSystemStore.Save", "store.sql_system.save.app_error", nil, "") } storeChannel <- result @@ -55,7 +55,7 @@ func (s SqlSystemStore) Update(system *model.System) StoreChannel { result := StoreResult{} if _, err := s.GetMaster().Update(system); err != nil { - result.Err = model.NewAppError("SqlSystemStore.Save", "We encountered an error updating the system property", "") + result.Err = model.NewLocAppError("SqlSystemStore.Update", "store.sql_system.update.app_error", nil, "") } storeChannel <- result @@ -75,7 +75,7 @@ func (s SqlSystemStore) Get() StoreChannel { var systems []model.System props := make(model.StringMap) if _, err := s.GetReplica().Select(&systems, "SELECT * FROM Systems"); err != nil { - result.Err = model.NewAppError("SqlSystemStore.Get", "We encountered an error finding the system properties", "") + result.Err = model.NewLocAppError("SqlSystemStore.Get", "store.sql_system.get.app_error", nil, "") } else { for _, prop := range systems { props[prop.Name] = prop.Value diff --git a/store/sql_team_store.go b/store/sql_team_store.go index 9578549ca..86ab9ac04 100644 --- a/store/sql_team_store.go +++ b/store/sql_team_store.go @@ -44,8 +44,8 @@ func (s SqlTeamStore) Save(team *model.Team) StoreChannel { result := StoreResult{} if len(team.Id) > 0 { - result.Err = model.NewAppError("SqlTeamStore.Save", - "Must call update for exisiting team", "id="+team.Id) + result.Err = model.NewLocAppError("SqlTeamStore.Save", + "store.sql_team.save.existing.app_error", nil, "id="+team.Id) storeChannel <- result close(storeChannel) return @@ -61,9 +61,9 @@ func (s SqlTeamStore) Save(team *model.Team) StoreChannel { if err := s.GetMaster().Insert(team); err != nil { if IsUniqueConstraintError(err.Error(), "Name", "teams_name_key") { - result.Err = model.NewAppError("SqlTeamStore.Save", "A team with that domain already exists", "id="+team.Id+", "+err.Error()) + result.Err = model.NewLocAppError("SqlTeamStore.Save", "store.sql_team.save.domain_exists.app_error", nil, "id="+team.Id+", "+err.Error()) } else { - result.Err = model.NewAppError("SqlTeamStore.Save", "We couldn't save the team", "id="+team.Id+", "+err.Error()) + result.Err = model.NewLocAppError("SqlTeamStore.Save", "store.sql_team.save.app_error", nil, "id="+team.Id+", "+err.Error()) } } else { result.Data = team @@ -92,9 +92,9 @@ func (s SqlTeamStore) Update(team *model.Team) StoreChannel { } if oldResult, err := s.GetMaster().Get(model.Team{}, team.Id); err != nil { - result.Err = model.NewAppError("SqlTeamStore.Update", "We encountered an error finding the team", "id="+team.Id+", "+err.Error()) + result.Err = model.NewLocAppError("SqlTeamStore.Update", "store.sql_team.update.finding.app_error", nil, "id="+team.Id+", "+err.Error()) } else if oldResult == nil { - result.Err = model.NewAppError("SqlTeamStore.Update", "We couldn't find the existing team to update", "id="+team.Id) + result.Err = model.NewLocAppError("SqlTeamStore.Update", "store.sql_team.update.find.app_error", nil, "id="+team.Id) } else { oldTeam := oldResult.(*model.Team) team.CreateAt = oldTeam.CreateAt @@ -102,9 +102,9 @@ func (s SqlTeamStore) Update(team *model.Team) StoreChannel { team.Name = oldTeam.Name if count, err := s.GetMaster().Update(team); err != nil { - result.Err = model.NewAppError("SqlTeamStore.Update", "We encountered an error updating the team", "id="+team.Id+", "+err.Error()) + result.Err = model.NewLocAppError("SqlTeamStore.Update", "store.sql_team.update.updating.app_error", nil, "id="+team.Id+", "+err.Error()) } else if count != 1 { - result.Err = model.NewAppError("SqlTeamStore.Update", "We couldn't update the team", "id="+team.Id) + result.Err = model.NewLocAppError("SqlTeamStore.Update", "store.sql_team.update.app_error", nil, "id="+team.Id) } else { result.Data = team } @@ -125,7 +125,7 @@ func (s SqlTeamStore) UpdateDisplayName(name string, teamId string) StoreChannel result := StoreResult{} if _, err := s.GetMaster().Exec("UPDATE Teams SET DisplayName = :Name WHERE Id = :Id", map[string]interface{}{"Name": name, "Id": teamId}); err != nil { - result.Err = model.NewAppError("SqlTeamStore.UpdateName", "We couldn't update the team name", "team_id="+teamId) + result.Err = model.NewLocAppError("SqlTeamStore.UpdateName", "store.sql_team.update_display_name.app_error", nil, "team_id="+teamId) } else { result.Data = teamId } @@ -144,9 +144,9 @@ func (s SqlTeamStore) Get(id string) StoreChannel { result := StoreResult{} if obj, err := s.GetReplica().Get(model.Team{}, id); err != nil { - result.Err = model.NewAppError("SqlTeamStore.Get", "We encountered an error finding the team", "id="+id+", "+err.Error()) + result.Err = model.NewLocAppError("SqlTeamStore.Get", "store.sql_team.get.finding.app_error", nil, "id="+id+", "+err.Error()) } else if obj == nil { - result.Err = model.NewAppError("SqlTeamStore.Get", "We couldn't find the existing team", "id="+id) + result.Err = model.NewLocAppError("SqlTeamStore.Get", "store.sql_team.get.find.app_error", nil, "id="+id) } else { team := obj.(*model.Team) if len(team.InviteId) == 0 { @@ -172,7 +172,7 @@ func (s SqlTeamStore) GetByInviteId(inviteId string) StoreChannel { team := model.Team{} if err := s.GetReplica().SelectOne(&team, "SELECT * FROM Teams WHERE Id = :InviteId OR InviteId = :InviteId", map[string]interface{}{"InviteId": inviteId}); err != nil { - result.Err = model.NewAppError("SqlTeamStore.GetByInviteId", "We couldn't find the existing team", "inviteId="+inviteId+", "+err.Error()) + result.Err = model.NewLocAppError("SqlTeamStore.GetByInviteId", "store.sql_team.get_by_invite_id.finding.app_error", nil, "inviteId="+inviteId+", "+err.Error()) } if len(team.InviteId) == 0 { @@ -180,7 +180,7 @@ func (s SqlTeamStore) GetByInviteId(inviteId string) StoreChannel { } if len(inviteId) == 0 || team.InviteId != inviteId { - result.Err = model.NewAppError("SqlTeamStore.GetByInviteId", "We couldn't find the existing team", "inviteId="+inviteId) + result.Err = model.NewLocAppError("SqlTeamStore.GetByInviteId", "store.sql_team.get_by_invite_id.find.app_error", nil, "inviteId="+inviteId) } result.Data = &team @@ -201,7 +201,7 @@ func (s SqlTeamStore) GetByName(name string) StoreChannel { team := model.Team{} if err := s.GetReplica().SelectOne(&team, "SELECT * FROM Teams WHERE Name = :Name", map[string]interface{}{"Name": name}); err != nil { - result.Err = model.NewAppError("SqlTeamStore.GetByName", "We couldn't find the existing team", "name="+name+", "+err.Error()) + result.Err = model.NewLocAppError("SqlTeamStore.GetByName", "store.sql_team.get_by_name.app_error", nil, "name="+name+", "+err.Error()) } if len(team.InviteId) == 0 { @@ -225,7 +225,7 @@ func (s SqlTeamStore) GetTeamsForEmail(email string) StoreChannel { var data []*model.Team if _, err := s.GetReplica().Select(&data, "SELECT Teams.* FROM Teams, Users WHERE Teams.Id = Users.TeamId AND Users.Email = :Email", map[string]interface{}{"Email": email}); err != nil { - result.Err = model.NewAppError("SqlTeamStore.GetTeamsForEmail", "We encountered a problem when looking up teams", "email="+email+", "+err.Error()) + result.Err = model.NewLocAppError("SqlTeamStore.GetTeamsForEmail", "store.sql_team.get_teams_for_email.app_error", nil, "email="+email+", "+err.Error()) } for _, team := range data { @@ -251,7 +251,7 @@ func (s SqlTeamStore) GetAll() StoreChannel { var data []*model.Team if _, err := s.GetReplica().Select(&data, "SELECT * FROM Teams"); err != nil { - result.Err = model.NewAppError("SqlTeamStore.GetAllTeams", "We could not get all teams", err.Error()) + result.Err = model.NewLocAppError("SqlTeamStore.GetAllTeams", "store.sql_team.get_all.app_error", nil, err.Error()) } for _, team := range data { @@ -283,7 +283,7 @@ func (s SqlTeamStore) GetAllTeamListing() StoreChannel { var data []*model.Team if _, err := s.GetReplica().Select(&data, query); err != nil { - result.Err = model.NewAppError("SqlTeamStore.GetAllTeams", "We could not get all teams", err.Error()) + result.Err = model.NewLocAppError("SqlTeamStore.GetAllTeams", "store.sql_team.get_all_team_listing.app_error", nil, err.Error()) } for _, team := range data { @@ -308,7 +308,7 @@ func (s SqlTeamStore) PermanentDelete(teamId string) StoreChannel { result := StoreResult{} if _, err := s.GetMaster().Exec("DELETE FROM Teams WHERE Id = :TeamId", map[string]interface{}{"TeamId": teamId}); err != nil { - result.Err = model.NewAppError("SqlTeamStore.Delete", "We couldn't delete the existing team", "teamId="+teamId+", "+err.Error()) + result.Err = model.NewLocAppError("SqlTeamStore.Delete", "store.sql_team.permanent_delete.app_error", nil, "teamId="+teamId+", "+err.Error()) } storeChannel <- result diff --git a/store/sql_user_store.go b/store/sql_user_store.go index efd8b7f33..4ea8af090 100644 --- a/store/sql_user_store.go +++ b/store/sql_user_store.go @@ -11,7 +11,7 @@ import ( ) const ( - MISSING_ACCOUNT_ERROR = "We couldn't find an existing account matching your email address for this team. This team may require an invite from the team owner to join." + MISSING_ACCOUNT_ERROR = "store.sql_user.missing_account.const" ) type SqlUserStore struct { @@ -62,7 +62,7 @@ func (us SqlUserStore) Save(user *model.User) StoreChannel { result := StoreResult{} if len(user.Id) > 0 { - result.Err = model.NewAppError("SqlUserStore.Save", "Must call update for exisiting user", "user_id="+user.Id) + result.Err = model.NewLocAppError("SqlUserStore.Save", "store.sql_user.save.existing.app_error", nil, "user_id="+user.Id) storeChannel <- result close(storeChannel) return @@ -76,12 +76,12 @@ func (us SqlUserStore) Save(user *model.User) StoreChannel { } if count, err := us.GetMaster().SelectInt("SELECT COUNT(0) FROM Users WHERE TeamId = :TeamId AND DeleteAt = 0", map[string]interface{}{"TeamId": user.TeamId}); err != nil { - result.Err = model.NewAppError("SqlUserStore.Save", "Failed to get current team member count", "teamId="+user.TeamId+", "+err.Error()) + result.Err = model.NewLocAppError("SqlUserStore.Save", "store.sql_user.save.member_count.app_error", nil, "teamId="+user.TeamId+", "+err.Error()) storeChannel <- result close(storeChannel) return } else if int(count) > utils.Cfg.TeamSettings.MaxUsersPerTeam { - result.Err = model.NewAppError("SqlUserStore.Save", "This team has reached the maxmium number of allowed accounts. Contact your systems administrator to set a higher limit.", "teamId="+user.TeamId) + result.Err = model.NewLocAppError("SqlUserStore.Save", "store.sql_user.save.max_accounts.app_error", nil, "teamId="+user.TeamId) storeChannel <- result close(storeChannel) return @@ -89,11 +89,11 @@ func (us SqlUserStore) Save(user *model.User) StoreChannel { if err := us.GetMaster().Insert(user); err != nil { if IsUniqueConstraintError(err.Error(), "Email", "users_email_teamid_key") { - result.Err = model.NewAppError("SqlUserStore.Save", "An account with that email already exists.", "user_id="+user.Id+", "+err.Error()) + result.Err = model.NewLocAppError("SqlUserStore.Save", "store.sql_user.save.email_exists.app_error", nil, "user_id="+user.Id+", "+err.Error()) } else if IsUniqueConstraintError(err.Error(), "Username", "users_username_teamid_key") { - result.Err = model.NewAppError("SqlUserStore.Save", "An account with that username already exists.", "user_id="+user.Id+", "+err.Error()) + result.Err = model.NewLocAppError("SqlUserStore.Save", "store.sql_user.save.username_exists.app_error", nil, "user_id="+user.Id+", "+err.Error()) } else { - result.Err = model.NewAppError("SqlUserStore.Save", "We couldn't save the account.", "user_id="+user.Id+", "+err.Error()) + result.Err = model.NewLocAppError("SqlUserStore.Save", "store.sql_user.save.app_error", nil, "user_id="+user.Id+", "+err.Error()) } } else { result.Data = user @@ -122,9 +122,9 @@ func (us SqlUserStore) Update(user *model.User, allowActiveUpdate bool) StoreCha } if oldUserResult, err := us.GetMaster().Get(model.User{}, user.Id); err != nil { - result.Err = model.NewAppError("SqlUserStore.Update", "We encountered an error finding the account", "user_id="+user.Id+", "+err.Error()) + result.Err = model.NewLocAppError("SqlUserStore.Update", "store.sql_user.update.finding.app_error", nil, "user_id="+user.Id+", "+err.Error()) } else if oldUserResult == nil { - result.Err = model.NewAppError("SqlUserStore.Update", "We couldn't find the existing account to update", "user_id="+user.Id) + result.Err = model.NewLocAppError("SqlUserStore.Update", "store.sql_user.update.find.app_error", nil, "user_id="+user.Id) } else { oldUser := oldUserResult.(*model.User) user.CreateAt = oldUser.CreateAt @@ -163,14 +163,14 @@ func (us SqlUserStore) Update(user *model.User, allowActiveUpdate bool) StoreCha if count, err := us.GetMaster().Update(user); err != nil { if IsUniqueConstraintError(err.Error(), "Email", "users_email_teamid_key") { - result.Err = model.NewAppError("SqlUserStore.Update", "This email is already taken. Please choose another.", "user_id="+user.Id+", "+err.Error()) + result.Err = model.NewLocAppError("SqlUserStore.Update", "store.sql_user.update.email_taken.app_error", nil, "user_id="+user.Id+", "+err.Error()) } else if IsUniqueConstraintError(err.Error(), "Username", "users_username_teamid_key") { - result.Err = model.NewAppError("SqlUserStore.Update", "This username is already taken. Please choose another.", "user_id="+user.Id+", "+err.Error()) + result.Err = model.NewLocAppError("SqlUserStore.Update", "store.sql_user.update.username_taken.app_error", nil, "user_id="+user.Id+", "+err.Error()) } else { - result.Err = model.NewAppError("SqlUserStore.Update", "We encountered an error updating the account", "user_id="+user.Id+", "+err.Error()) + result.Err = model.NewLocAppError("SqlUserStore.Update", "store.sql_user.update.updating.app_error", nil, "user_id="+user.Id+", "+err.Error()) } } else if count != 1 { - result.Err = model.NewAppError("SqlUserStore.Update", "We couldn't update the account", fmt.Sprintf("user_id=%v, count=%v", user.Id, count)) + result.Err = model.NewLocAppError("SqlUserStore.Update", "store.sql_user.update.app_error", nil, fmt.Sprintf("user_id=%v, count=%v", user.Id, count)) } else { result.Data = [2]*model.User{user, oldUser} } @@ -192,7 +192,7 @@ func (us SqlUserStore) UpdateLastPictureUpdate(userId string) StoreChannel { curTime := model.GetMillis() if _, err := us.GetMaster().Exec("UPDATE Users SET LastPictureUpdate = :Time, UpdateAt = :Time WHERE Id = :UserId", map[string]interface{}{"Time": curTime, "UserId": userId}); err != nil { - result.Err = model.NewAppError("SqlUserStore.UpdateUpdateAt", "We couldn't update the update_at", "user_id="+userId) + result.Err = model.NewLocAppError("SqlUserStore.UpdateUpdateAt", "store.sql_user.update_last_picture_update.app_error", nil, "user_id="+userId) } else { result.Data = userId } @@ -211,7 +211,7 @@ func (us SqlUserStore) UpdateLastPingAt(userId string, time int64) StoreChannel result := StoreResult{} if _, err := us.GetMaster().Exec("UPDATE Users SET LastPingAt = :LastPingAt WHERE Id = :UserId", map[string]interface{}{"LastPingAt": time, "UserId": userId}); err != nil { - result.Err = model.NewAppError("SqlUserStore.UpdateLastPingAt", "We couldn't update the last_ping_at", "user_id="+userId) + result.Err = model.NewLocAppError("SqlUserStore.UpdateLastPingAt", "store.sql_user.update_last_ping.app_error", nil, "user_id="+userId) } else { result.Data = userId } @@ -230,7 +230,7 @@ func (us SqlUserStore) UpdateLastActivityAt(userId string, time int64) StoreChan result := StoreResult{} if _, err := us.GetMaster().Exec("UPDATE Users SET LastActivityAt = :LastActivityAt WHERE Id = :UserId", map[string]interface{}{"LastActivityAt": time, "UserId": userId}); err != nil { - result.Err = model.NewAppError("SqlUserStore.UpdateLastActivityAt", "We couldn't update the last_activity_at", "user_id="+userId) + result.Err = model.NewLocAppError("SqlUserStore.UpdateLastActivityAt", "store.sql_user.update_last_activity.app_error", nil, "user_id="+userId) } else { result.Data = userId } @@ -249,9 +249,9 @@ func (us SqlUserStore) UpdateUserAndSessionActivity(userId string, sessionId str result := StoreResult{} if _, err := us.GetMaster().Exec("UPDATE Users SET LastActivityAt = :UserLastActivityAt WHERE Id = :UserId", map[string]interface{}{"UserLastActivityAt": time, "UserId": userId}); err != nil { - result.Err = model.NewAppError("SqlUserStore.UpdateLastActivityAt", "We couldn't update the last_activity_at", "1 user_id="+userId+" session_id="+sessionId+" err="+err.Error()) + result.Err = model.NewLocAppError("SqlUserStore.UpdateLastActivityAt", "store.sql_user.update_last_activity.app_error", nil, "1 user_id="+userId+" session_id="+sessionId+" err="+err.Error()) } else if _, err := us.GetMaster().Exec("UPDATE Sessions SET LastActivityAt = :SessionLastActivityAt WHERE Id = :SessionId", map[string]interface{}{"SessionLastActivityAt": time, "SessionId": sessionId}); err != nil { - result.Err = model.NewAppError("SqlUserStore.UpdateLastActivityAt", "We couldn't update the last_activity_at", "2 user_id="+userId+" session_id="+sessionId+" err="+err.Error()) + result.Err = model.NewLocAppError("SqlUserStore.UpdateLastActivityAt", "store.sql_user.update_last_activity.app_error", nil, "2 user_id="+userId+" session_id="+sessionId+" err="+err.Error()) } else { result.Data = userId } @@ -273,7 +273,7 @@ func (us SqlUserStore) UpdatePassword(userId, hashedPassword string) StoreChanne updateAt := model.GetMillis() if _, err := us.GetMaster().Exec("UPDATE Users SET Password = :Password, LastPasswordUpdate = :LastPasswordUpdate, UpdateAt = :UpdateAt, AuthData = '', AuthService = '', FailedAttempts = 0 WHERE Id = :UserId", map[string]interface{}{"Password": hashedPassword, "LastPasswordUpdate": updateAt, "UpdateAt": updateAt, "UserId": userId}); err != nil { - result.Err = model.NewAppError("SqlUserStore.UpdatePassword", "We couldn't update the user password", "id="+userId+", "+err.Error()) + result.Err = model.NewLocAppError("SqlUserStore.UpdatePassword", "store.sql_user.update_password.app_error", nil, "id="+userId+", "+err.Error()) } else { result.Data = userId } @@ -292,7 +292,7 @@ func (us SqlUserStore) UpdateFailedPasswordAttempts(userId string, attempts int) result := StoreResult{} if _, err := us.GetMaster().Exec("UPDATE Users SET FailedAttempts = :FailedAttempts WHERE Id = :UserId", map[string]interface{}{"FailedAttempts": attempts, "UserId": userId}); err != nil { - result.Err = model.NewAppError("SqlUserStore.UpdateFailedPasswordAttempts", "We couldn't update the failed_attempts", "user_id="+userId) + result.Err = model.NewLocAppError("SqlUserStore.UpdateFailedPasswordAttempts", "store.sql_user.update_failed_pwd_attempts.app_error", nil, "user_id="+userId) } else { result.Data = userId } @@ -314,7 +314,7 @@ func (us SqlUserStore) UpdateAuthData(userId, service, authData string) StoreCha updateAt := model.GetMillis() if _, err := us.GetMaster().Exec("UPDATE Users SET Password = '', LastPasswordUpdate = :LastPasswordUpdate, UpdateAt = :UpdateAt, FailedAttempts = 0, AuthService = :AuthService, AuthData = :AuthData WHERE Id = :UserId", map[string]interface{}{"LastPasswordUpdate": updateAt, "UpdateAt": updateAt, "UserId": userId, "AuthService": service, "AuthData": authData}); err != nil { - result.Err = model.NewAppError("SqlUserStore.UpdateAuthData", "We couldn't update the auth data", "id="+userId+", "+err.Error()) + result.Err = model.NewLocAppError("SqlUserStore.UpdateAuthData", "store.sql_user.update_auth_data.app_error", nil, "id="+userId+", "+err.Error()) } else { result.Data = userId } @@ -334,9 +334,9 @@ func (us SqlUserStore) Get(id string) StoreChannel { result := StoreResult{} if obj, err := us.GetReplica().Get(model.User{}, id); err != nil { - result.Err = model.NewAppError("SqlUserStore.Get", "We encountered an error finding the account", "user_id="+id+", "+err.Error()) + result.Err = model.NewLocAppError("SqlUserStore.Get", "store.sql_user.get.app_error", nil, "user_id="+id+", "+err.Error()) } else if obj == nil { - result.Err = model.NewAppError("SqlUserStore.Get", MISSING_ACCOUNT_ERROR, "user_id="+id) + result.Err = model.NewLocAppError("SqlUserStore.Get", MISSING_ACCOUNT_ERROR, nil, "user_id="+id) } else { result.Data = obj.(*model.User) } @@ -379,7 +379,7 @@ func (us SqlUserStore) GetProfiles(teamId string) StoreChannel { var users []*model.User if _, err := us.GetReplica().Select(&users, "SELECT * FROM Users WHERE TeamId = :TeamId", map[string]interface{}{"TeamId": teamId}); err != nil { - result.Err = model.NewAppError("SqlUserStore.GetProfiles", "We encountered an error while finding user profiles", err.Error()) + result.Err = model.NewLocAppError("SqlUserStore.GetProfiles", "store.sql_user.get_profiles.app_error", nil, err.Error()) } else { userMap := make(map[string]*model.User) @@ -410,7 +410,7 @@ func (us SqlUserStore) GetSystemAdminProfiles() StoreChannel { var users []*model.User if _, err := us.GetReplica().Select(&users, "SELECT * FROM Users WHERE Roles = :Roles", map[string]interface{}{"Roles": "system_admin"}); err != nil { - result.Err = model.NewAppError("SqlUserStore.GetSystemAdminProfiles", "We encountered an error while finding user profiles", err.Error()) + result.Err = model.NewLocAppError("SqlUserStore.GetSystemAdminProfiles", "store.sql_user.get_sysadmin_profiles.app_error", nil, err.Error()) } else { userMap := make(map[string]*model.User) @@ -441,7 +441,7 @@ func (us SqlUserStore) GetByEmail(teamId string, email string) StoreChannel { user := model.User{} if err := us.GetReplica().SelectOne(&user, "SELECT * FROM Users WHERE TeamId = :TeamId AND Email = :Email", map[string]interface{}{"TeamId": teamId, "Email": email}); err != nil { - result.Err = model.NewAppError("SqlUserStore.GetByEmail", MISSING_ACCOUNT_ERROR, "teamId="+teamId+", email="+email+", "+err.Error()) + result.Err = model.NewLocAppError("SqlUserStore.GetByEmail", MISSING_ACCOUNT_ERROR, nil, "teamId="+teamId+", email="+email+", "+err.Error()) } result.Data = &user @@ -463,7 +463,8 @@ func (us SqlUserStore) GetByAuth(teamId string, authData string, authService str user := model.User{} if err := us.GetReplica().SelectOne(&user, "SELECT * FROM Users WHERE TeamId = :TeamId AND AuthData = :AuthData AND AuthService = :AuthService", map[string]interface{}{"TeamId": teamId, "AuthData": authData, "AuthService": authService}); err != nil { - result.Err = model.NewAppError("SqlUserStore.GetByAuth", "We couldn't find an existing account matching your authentication type for this team. This team may require an invite from the team owner to join.", "teamId="+teamId+", authData="+authData+", authService="+authService+", "+err.Error()) + result.Err = model.NewLocAppError("SqlUserStore.GetByAuth", "store.sql_user.get_by_auth.app_error", + nil, "teamId="+teamId+", authData="+authData+", authService="+authService+", "+err.Error()) } result.Data = &user @@ -485,7 +486,8 @@ func (us SqlUserStore) GetByUsername(teamId string, username string) StoreChanne user := model.User{} if err := us.GetReplica().SelectOne(&user, "SELECT * FROM Users WHERE TeamId = :TeamId AND Username = :Username", map[string]interface{}{"TeamId": teamId, "Username": username}); err != nil { - result.Err = model.NewAppError("SqlUserStore.GetByUsername", "We couldn't find an existing account matching your username for this team. This team may require an invite from the team owner to join.", "teamId="+teamId+", username="+username+", "+err.Error()) + result.Err = model.NewLocAppError("SqlUserStore.GetByUsername", "store.sql_user.get_by_username.app_error", + nil, "teamId="+teamId+", username="+username+", "+err.Error()) } result.Data = &user @@ -504,7 +506,7 @@ func (us SqlUserStore) VerifyEmail(userId string) StoreChannel { result := StoreResult{} if _, err := us.GetMaster().Exec("UPDATE Users SET EmailVerified = '1' WHERE Id = :UserId", map[string]interface{}{"UserId": userId}); err != nil { - result.Err = model.NewAppError("SqlUserStore.VerifyEmail", "Unable to update verify email field", "userId="+userId+", "+err.Error()) + result.Err = model.NewLocAppError("SqlUserStore.VerifyEmail", "store.sql_user.verify_email.app_error", nil, "userId="+userId+", "+err.Error()) } result.Data = userId @@ -526,7 +528,7 @@ func (us SqlUserStore) GetForExport(teamId string) StoreChannel { var users []*model.User if _, err := us.GetReplica().Select(&users, "SELECT * FROM Users WHERE TeamId = :TeamId", map[string]interface{}{"TeamId": teamId}); err != nil { - result.Err = model.NewAppError("SqlUserStore.GetProfiles", "We encountered an error while finding user profiles", err.Error()) + result.Err = model.NewLocAppError("SqlUserStore.GetProfiles", "store.sql_user.get_for_export.app_error", nil, err.Error()) } else { for _, u := range users { u.Password = "" @@ -550,7 +552,7 @@ func (us SqlUserStore) GetTotalUsersCount() StoreChannel { result := StoreResult{} if count, err := us.GetReplica().SelectInt("SELECT COUNT(Id) FROM Users"); err != nil { - result.Err = model.NewAppError("SqlUserStore.GetTotalUsersCount", "We could not count the users", err.Error()) + result.Err = model.NewLocAppError("SqlUserStore.GetTotalUsersCount", "store.sql_user.get_total_users_count.app_error", nil, err.Error()) } else { result.Data = count } @@ -571,7 +573,7 @@ func (us SqlUserStore) GetTotalActiveUsersCount() StoreChannel { time := model.GetMillis() - (1000 * 60 * 60 * 24) if count, err := us.GetReplica().SelectInt("SELECT COUNT(Id) FROM Users WHERE LastActivityAt > :Time", map[string]interface{}{"Time": time}); err != nil { - result.Err = model.NewAppError("SqlUserStore.GetTotalActiveUsersCount", "We could not count the users", err.Error()) + result.Err = model.NewLocAppError("SqlUserStore.GetTotalActiveUsersCount", "store.sql_user.get_total_active_users_count.app_error", nil, err.Error()) } else { result.Data = count } @@ -591,7 +593,7 @@ func (us SqlUserStore) PermanentDelete(userId string) StoreChannel { result := StoreResult{} if _, err := us.GetMaster().Exec("DELETE FROM Users WHERE Id = :UserId", map[string]interface{}{"UserId": userId}); err != nil { - result.Err = model.NewAppError("SqlUserStore.GetByEmail", "We couldn't delete the existing account", "userId="+userId+", "+err.Error()) + result.Err = model.NewLocAppError("SqlUserStore.GetByEmail", "store.sql_user.permanent_delete.app_error", nil, "userId="+userId+", "+err.Error()) } storeChannel <- result @@ -616,7 +618,7 @@ func (us SqlUserStore) AnalyticsUniqueUserCount(teamId string) StoreChannel { v, err := us.GetReplica().SelectInt(query, map[string]interface{}{"TeamId": teamId}) if err != nil { - result.Err = model.NewAppError("SqlUserStore.AnalyticsUniqueUserCount", "We couldn't get the unique user count", err.Error()) + result.Err = model.NewLocAppError("SqlUserStore.AnalyticsUniqueUserCount", "store.sql_user.analytics_unique_user_count.app_error", nil, err.Error()) } else { result.Data = v } diff --git a/store/sql_webhook_store.go b/store/sql_webhook_store.go index b7bf0615f..cdfb949f5 100644 --- a/store/sql_webhook_store.go +++ b/store/sql_webhook_store.go @@ -50,8 +50,8 @@ func (s SqlWebhookStore) SaveIncoming(webhook *model.IncomingWebhook) StoreChann result := StoreResult{} if len(webhook.Id) > 0 { - result.Err = model.NewAppError("SqlWebhookStore.SaveIncoming", - "You cannot overwrite an existing IncomingWebhook", "id="+webhook.Id) + result.Err = model.NewLocAppError("SqlWebhookStore.SaveIncoming", + "store.sql_webhooks.save_incoming.existing.app_error", nil, "id="+webhook.Id) storeChannel <- result close(storeChannel) return @@ -65,7 +65,7 @@ func (s SqlWebhookStore) SaveIncoming(webhook *model.IncomingWebhook) StoreChann } if err := s.GetMaster().Insert(webhook); err != nil { - result.Err = model.NewAppError("SqlWebhookStore.SaveIncoming", "We couldn't save the IncomingWebhook", "id="+webhook.Id+", "+err.Error()) + result.Err = model.NewLocAppError("SqlWebhookStore.SaveIncoming", "store.sql_webhooks.save_incoming.app_error", nil, "id="+webhook.Id+", "+err.Error()) } else { result.Data = webhook } @@ -86,7 +86,7 @@ func (s SqlWebhookStore) GetIncoming(id string) StoreChannel { var webhook model.IncomingWebhook if err := s.GetReplica().SelectOne(&webhook, "SELECT * FROM IncomingWebhooks WHERE Id = :Id AND DeleteAt = 0", map[string]interface{}{"Id": id}); err != nil { - result.Err = model.NewAppError("SqlWebhookStore.GetIncoming", "We couldn't get the webhook", "id="+id+", err="+err.Error()) + result.Err = model.NewLocAppError("SqlWebhookStore.GetIncoming", "store.sql_webhooks.get_incoming.app_error", nil, "id="+id+", err="+err.Error()) } result.Data = &webhook @@ -106,7 +106,7 @@ func (s SqlWebhookStore) DeleteIncoming(webhookId string, time int64) StoreChann _, err := s.GetMaster().Exec("Update IncomingWebhooks SET DeleteAt = :DeleteAt, UpdateAt = :UpdateAt WHERE Id = :Id", map[string]interface{}{"DeleteAt": time, "UpdateAt": time, "Id": webhookId}) if err != nil { - result.Err = model.NewAppError("SqlWebhookStore.DeleteIncoming", "We couldn't delete the webhook", "id="+webhookId+", err="+err.Error()) + result.Err = model.NewLocAppError("SqlWebhookStore.DeleteIncoming", "store.sql_webhooks.delete_incoming.app_error", nil, "id="+webhookId+", err="+err.Error()) } storeChannel <- result @@ -124,7 +124,7 @@ func (s SqlWebhookStore) PermanentDeleteIncomingByUser(userId string) StoreChann _, err := s.GetMaster().Exec("DELETE FROM IncomingWebhooks WHERE UserId = :UserId", map[string]interface{}{"UserId": userId}) if err != nil { - result.Err = model.NewAppError("SqlWebhookStore.DeleteIncomingByUser", "We couldn't delete the webhook", "id="+userId+", err="+err.Error()) + result.Err = model.NewLocAppError("SqlWebhookStore.DeleteIncomingByUser", "store.sql_webhooks.permanent_delete_incoming_by_user.app_error", nil, "id="+userId+", err="+err.Error()) } storeChannel <- result @@ -143,7 +143,7 @@ func (s SqlWebhookStore) GetIncomingByUser(userId string) StoreChannel { var webhooks []*model.IncomingWebhook if _, err := s.GetReplica().Select(&webhooks, "SELECT * FROM IncomingWebhooks WHERE UserId = :UserId AND DeleteAt = 0", map[string]interface{}{"UserId": userId}); err != nil { - result.Err = model.NewAppError("SqlWebhookStore.GetIncomingByUser", "We couldn't get the webhook", "userId="+userId+", err="+err.Error()) + result.Err = model.NewLocAppError("SqlWebhookStore.GetIncomingByUser", "store.sql_webhooks.get_incoming_by_user.app_error", nil, "userId="+userId+", err="+err.Error()) } result.Data = webhooks @@ -164,7 +164,7 @@ func (s SqlWebhookStore) GetIncomingByChannel(channelId string) StoreChannel { var webhooks []*model.IncomingWebhook if _, err := s.GetReplica().Select(&webhooks, "SELECT * FROM IncomingWebhooks WHERE ChannelId = :ChannelId AND DeleteAt = 0", map[string]interface{}{"ChannelId": channelId}); err != nil { - result.Err = model.NewAppError("SqlWebhookStore.GetIncomingByChannel", "We couldn't get the webhooks", "channelId="+channelId+", err="+err.Error()) + result.Err = model.NewLocAppError("SqlWebhookStore.GetIncomingByChannel", "store.sql_webhooks.get_incoming_by_channel.app_error", nil, "channelId="+channelId+", err="+err.Error()) } result.Data = webhooks @@ -183,8 +183,8 @@ func (s SqlWebhookStore) SaveOutgoing(webhook *model.OutgoingWebhook) StoreChann result := StoreResult{} if len(webhook.Id) > 0 { - result.Err = model.NewAppError("SqlWebhookStore.SaveOutgoing", - "You cannot overwrite an existing OutgoingWebhook", "id="+webhook.Id) + result.Err = model.NewLocAppError("SqlWebhookStore.SaveOutgoing", + "store.sql_webhooks.save_outgoing.override.app_error", nil, "id="+webhook.Id) storeChannel <- result close(storeChannel) return @@ -198,7 +198,7 @@ func (s SqlWebhookStore) SaveOutgoing(webhook *model.OutgoingWebhook) StoreChann } if err := s.GetMaster().Insert(webhook); err != nil { - result.Err = model.NewAppError("SqlWebhookStore.SaveOutgoing", "We couldn't save the OutgoingWebhook", "id="+webhook.Id+", "+err.Error()) + result.Err = model.NewLocAppError("SqlWebhookStore.SaveOutgoing", "store.sql_webhooks.save_outgoing.app_error", nil, "id="+webhook.Id+", "+err.Error()) } else { result.Data = webhook } @@ -219,7 +219,7 @@ func (s SqlWebhookStore) GetOutgoing(id string) StoreChannel { var webhook model.OutgoingWebhook if err := s.GetReplica().SelectOne(&webhook, "SELECT * FROM OutgoingWebhooks WHERE Id = :Id AND DeleteAt = 0", map[string]interface{}{"Id": id}); err != nil { - result.Err = model.NewAppError("SqlWebhookStore.GetOutgoing", "We couldn't get the webhook", "id="+id+", err="+err.Error()) + result.Err = model.NewLocAppError("SqlWebhookStore.GetOutgoing", "store.sql_webhooks.get_outgoing.app_error", nil, "id="+id+", err="+err.Error()) } result.Data = &webhook @@ -240,7 +240,7 @@ func (s SqlWebhookStore) GetOutgoingByCreator(userId string) StoreChannel { var webhooks []*model.OutgoingWebhook if _, err := s.GetReplica().Select(&webhooks, "SELECT * FROM OutgoingWebhooks WHERE CreatorId = :UserId AND DeleteAt = 0", map[string]interface{}{"UserId": userId}); err != nil { - result.Err = model.NewAppError("SqlWebhookStore.GetOutgoingByCreator", "We couldn't get the webhooks", "userId="+userId+", err="+err.Error()) + result.Err = model.NewLocAppError("SqlWebhookStore.GetOutgoingByCreator", "store.sql_webhooks.get_outgoing_by_creator.app_error", nil, "userId="+userId+", err="+err.Error()) } result.Data = webhooks @@ -261,7 +261,7 @@ func (s SqlWebhookStore) GetOutgoingByChannel(channelId string) StoreChannel { var webhooks []*model.OutgoingWebhook if _, err := s.GetReplica().Select(&webhooks, "SELECT * FROM OutgoingWebhooks WHERE ChannelId = :ChannelId AND DeleteAt = 0", map[string]interface{}{"ChannelId": channelId}); err != nil { - result.Err = model.NewAppError("SqlWebhookStore.GetOutgoingByChannel", "We couldn't get the webhooks", "channelId="+channelId+", err="+err.Error()) + result.Err = model.NewLocAppError("SqlWebhookStore.GetOutgoingByChannel", "store.sql_webhooks.get_outgoing_by_channel.app_error", nil, "channelId="+channelId+", err="+err.Error()) } result.Data = webhooks @@ -282,7 +282,7 @@ func (s SqlWebhookStore) GetOutgoingByTeam(teamId string) StoreChannel { var webhooks []*model.OutgoingWebhook if _, err := s.GetReplica().Select(&webhooks, "SELECT * FROM OutgoingWebhooks WHERE TeamId = :TeamId AND DeleteAt = 0", map[string]interface{}{"TeamId": teamId}); err != nil { - result.Err = model.NewAppError("SqlWebhookStore.GetOutgoingByTeam", "We couldn't get the webhooks", "teamId="+teamId+", err="+err.Error()) + result.Err = model.NewLocAppError("SqlWebhookStore.GetOutgoingByTeam", "store.sql_webhooks.get_outgoing_by_team.app_error", nil, "teamId="+teamId+", err="+err.Error()) } result.Data = webhooks @@ -302,7 +302,7 @@ func (s SqlWebhookStore) DeleteOutgoing(webhookId string, time int64) StoreChann _, err := s.GetMaster().Exec("Update OutgoingWebhooks SET DeleteAt = :DeleteAt, UpdateAt = :UpdateAt WHERE Id = :Id", map[string]interface{}{"DeleteAt": time, "UpdateAt": time, "Id": webhookId}) if err != nil { - result.Err = model.NewAppError("SqlWebhookStore.DeleteOutgoing", "We couldn't delete the webhook", "id="+webhookId+", err="+err.Error()) + result.Err = model.NewLocAppError("SqlWebhookStore.DeleteOutgoing", "store.sql_webhooks.delete_outgoing.app_error", nil, "id="+webhookId+", err="+err.Error()) } storeChannel <- result @@ -320,7 +320,7 @@ func (s SqlWebhookStore) PermanentDeleteOutgoingByUser(userId string) StoreChann _, err := s.GetMaster().Exec("DELETE FROM OutgoingWebhooks WHERE CreatorId = :UserId", map[string]interface{}{"UserId": userId}) if err != nil { - result.Err = model.NewAppError("SqlWebhookStore.DeleteOutgoingByUser", "We couldn't delete the webhook", "id="+userId+", err="+err.Error()) + result.Err = model.NewLocAppError("SqlWebhookStore.DeleteOutgoingByUser", "store.sql_webhooks.permanent_delete_outgoing_by_user.app_error", nil, "id="+userId+", err="+err.Error()) } storeChannel <- result @@ -339,7 +339,7 @@ func (s SqlWebhookStore) UpdateOutgoing(hook *model.OutgoingWebhook) StoreChanne hook.UpdateAt = model.GetMillis() if _, err := s.GetMaster().Update(hook); err != nil { - result.Err = model.NewAppError("SqlWebhookStore.UpdateOutgoing", "We couldn't update the webhook", "id="+hook.Id+", "+err.Error()) + result.Err = model.NewLocAppError("SqlWebhookStore.UpdateOutgoing", "store.sql_webhooks.update_outgoing.app_error", nil, "id="+hook.Id+", "+err.Error()) } else { result.Data = hook } -- cgit v1.2.3-1-g7c22