Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Evaluate values in handle failure #3235

Merged
merged 19 commits into from
Aug 27, 2021
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
5b30f16
[FIX] HEvaluating proper the error for channel, team and undefined
reinaldonetof Jun 22, 2021
3e0c5bf
Added some team errors in i18n
reinaldonetof Jun 22, 2021
ffdeb6c
Added unauthorized to i18n
reinaldonetof Jun 23, 2021
17efa73
Test if there is channel name too, to prevent to show {missing roomName}
reinaldonetof Jun 23, 2021
2690ef1
Refactor the treatment error to check if exists before translate with…
reinaldonetof Jul 5, 2021
bafd890
Merge branch 'develop' into fix.evaluate-vals-handle-failure-bugsnag
reinaldonetof Jul 13, 2021
dbac8cc
Remove some check conditional points
reinaldonetof Jul 13, 2021
6aae765
Merge branch 'develop' into fix.evaluate-vals-handle-failure-bugsnag
reinaldonetof Jul 13, 2021
62ab637
Minor tweak
gerzonc Jul 16, 2021
bc3f7c0
Merge branch 'develop' into fix.evaluate-vals-handle-failure-bugsnag
gerzonc Jul 16, 2021
60c6600
Merge branch 'develop' into fix.evaluate-vals-handle-failure-bugsnag
reinaldonetof Jul 20, 2021
1ff53f0
Merge branch 'develop' into fix.evaluate-vals-handle-failure-bugsnag
reinaldonetof Jul 20, 2021
56a007b
Merge branch 'develop' into fix.evaluate-vals-handle-failure-bugsnag
reinaldonetof Jul 27, 2021
47acf5c
Added array with error inside the createChannel
reinaldonetof Jul 27, 2021
85b78e1
Merge branch 'develop' into fix.evaluate-vals-handle-failure-bugsnag
gerzonc Aug 10, 2021
fdf31e4
Moved error array to inside the handleFailure
reinaldonetof Aug 11, 2021
1ad7d87
Merge branch 'develop' into fix.evaluate-vals-handle-failure-bugsnag
reinaldonetof Aug 23, 2021
b85ea7f
added creating_discussion
reinaldonetof Aug 24, 2021
a5c90f4
Merge branch 'develop' into fix.evaluate-vals-handle-failure-bugsnag
diegolmello Aug 27, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,9 @@
"Load_More": "Load More",
"Load_Newer": "Load Newer",
"Load_Older": "Load Older",
"room-name-already-exists": "Room name already exists",
"error-team-creation": "Error team creation",
"unauthorized": "Unauthorized",
"Left_The_Room_Successfully": "Left the room successfully",
"Deleted_The_Team_Successfully": "Team deleted successfully",
"Deleted_The_Room_Successfully": "Room deleted successfully",
Expand Down
3 changes: 3 additions & 0 deletions app/i18n/locales/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,9 @@
"Left_The_Team_Successfully": "Saiu do time com sucesso",
"Add_Existing_Channel": "Adicionar Canal Existente",
"invalid-room": "Sala inválida",
"room-name-already-exists": "Nome da sala já existe",
"error-team-creation": "Erro na criação do time",
"unauthorized": "Não autorizado",
"Left_The_Room_Successfully": "Saiu da sala com sucesso",
"Deleted_The_Team_Successfully": "Time deletado com sucesso",
"Deleted_The_Room_Successfully": "Sala deletada com sucesso",
Expand Down
9 changes: 8 additions & 1 deletion app/sagas/createChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import database from '../lib/database';
import I18n from '../i18n';
import { logEvent, events } from '../utils/log';
import { goRoom } from '../utils/goRoom';
import i18nEnJson from '../i18n/locales/en.json';

const createChannel = function createChannel(data) {
return RocketChat.createChannel(data);
Expand Down Expand Up @@ -110,7 +111,13 @@ const handleSuccess = function* handleSuccess({ data }) {

const handleFailure = function handleFailure({ err, isTeam }) {
setTimeout(() => {
const msg = err.data.errorType ? I18n.t(err.data.errorType, { room_name: err.data.details.channel_name }) : err.reason || I18n.t('There_was_an_error_while_action', { action: isTeam ? I18n.t('creating_team') : I18n.t('creating_channel') });
let msg = '';
const actionError = I18n.t('There_was_an_error_while_action', { action: isTeam ? I18n.t('creating_team') : I18n.t('creating_channel') });
if (err?.data?.errorType && err?.data?.details?.channel_name) {
msg = i18nEnJson[err.data.errorType] ? I18n.t(err.data.errorType, { room_name: err.data.details.channel_name }) : actionError;
} else {
msg = err?.reason || (i18nEnJson[err?.data?.error] ? I18n.t(err.data.error) : err.data.error || actionError);
}
showErrorAlert(msg, isTeam ? I18n.t('Create_Team') : I18n.t('Create_Channel'));
}, 300);
};
Expand Down