From 1f914ac19fad25d6bab0265d6dea77f5fcaef2d6 Mon Sep 17 00:00:00 2001 From: Reinaldo Neto Date: Fri, 21 May 2021 18:26:35 -0300 Subject: [PATCH 1/3] [IMPROVEMENT] Add error to AddExistingChannel --- app/i18n/locales/en.json | 1 + app/i18n/locales/pt-BR.json | 3 ++- app/views/AddExistingChannelView.js | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/i18n/locales/en.json b/app/i18n/locales/en.json index 8cc6cb2787..eb7c364e73 100644 --- a/app/i18n/locales/en.json +++ b/app/i18n/locales/en.json @@ -61,6 +61,7 @@ "error-message-editing-blocked": "Message editing is blocked", "error-message-size-exceeded": "Message size exceeds Message_MaxAllowedSize", "error-missing-unsubscribe-link": "You must provide the [unsubscribe] link.", + "error-no-owner-channel":"You don't own the channel", "error-no-tokens-for-this-user": "There are no tokens for this user", "error-not-allowed": "Not allowed", "error-not-authorized": "Not authorized", diff --git a/app/i18n/locales/pt-BR.json b/app/i18n/locales/pt-BR.json index 64369e7811..7eca8b0498 100644 --- a/app/i18n/locales/pt-BR.json +++ b/app/i18n/locales/pt-BR.json @@ -667,5 +667,6 @@ "Teams": "Times", "No_team_channels_found": "Nenhum canal encontrado", "Team_not_found": "Time não encontrado", - "Private_Team": "Equipe Privada" + "Private_Team": "Equipe Privada", + "Add_Existing_Channel": "Adicionar Canal Existente" } \ No newline at end of file diff --git a/app/views/AddExistingChannelView.js b/app/views/AddExistingChannelView.js index a3acf9e239..19934c433b 100644 --- a/app/views/AddExistingChannelView.js +++ b/app/views/AddExistingChannelView.js @@ -20,6 +20,7 @@ import SafeAreaView from '../containers/SafeAreaView'; import { animateNextTransition } from '../utils/layoutAnimation'; import { goRoom } from '../utils/goRoom'; import Loading from '../containers/Loading'; +import { showErrorAlert } from '../utils/info'; const QUERY_SIZE = 50; @@ -121,6 +122,7 @@ class AddExistingChannelView extends React.Component { goRoom({ item: result, isMasterDetail }); } } catch (e) { + showErrorAlert(I18n.t(e.data.error), I18n.t('Add_Existing_Channel'), () => {}); logEvent(events.CT_ADD_ROOM_TO_TEAM_F); this.setState({ loading: false }); } From 984c61ca8203c8d1fcb3773131460fd0bab4b6d2 Mon Sep 17 00:00:00 2001 From: Reinaldo Neto Date: Fri, 21 May 2021 19:04:44 -0300 Subject: [PATCH 2/3] Fix the alert error when create a channel --- app/sagas/createChannel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/sagas/createChannel.js b/app/sagas/createChannel.js index 8979e230eb..138a19bc51 100644 --- a/app/sagas/createChannel.js +++ b/app/sagas/createChannel.js @@ -110,7 +110,7 @@ const handleSuccess = function* handleSuccess({ data }) { const handleFailure = function handleFailure({ err }) { setTimeout(() => { - const msg = err.data ? I18n.t(err.data.error) : err.reason || I18n.t('There_was_an_error_while_action', { action: I18n.t('creating_channel') }); + const msg = err.data ? I18n.t(err.data.errorType, { room_name: err.data.details.channel_name }) : err.reason || I18n.t('There_was_an_error_while_action', { action: I18n.t('creating_channel') }); showErrorAlert(msg); }, 300); }; From 0c045139c0f3a50e4768894f433289f42fd5508e Mon Sep 17 00:00:00 2001 From: Reinaldo Neto Date: Fri, 21 May 2021 20:02:51 -0300 Subject: [PATCH 3/3] Fix the error alert box when create channel and teams --- app/actions/createChannel.js | 5 +++-- app/sagas/createChannel.js | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/actions/createChannel.js b/app/actions/createChannel.js index 60a8cca304..c93b47ef44 100644 --- a/app/actions/createChannel.js +++ b/app/actions/createChannel.js @@ -14,9 +14,10 @@ export function createChannelSuccess(data) { }; } -export function createChannelFailure(err) { +export function createChannelFailure(err, isTeam) { return { type: types.CREATE_CHANNEL.FAILURE, - err + err, + isTeam }; } diff --git a/app/sagas/createChannel.js b/app/sagas/createChannel.js index 138a19bc51..a768916c8b 100644 --- a/app/sagas/createChannel.js +++ b/app/sagas/createChannel.js @@ -96,7 +96,7 @@ const handleRequest = function* handleRequest({ data }) { yield put(createChannelSuccess(sub)); } catch (err) { logEvent(events[data.group ? 'SELECTED_USERS_CREATE_GROUP_F' : 'CR_CREATE_F']); - yield put(createChannelFailure(err)); + yield put(createChannelFailure(err, data.isTeam)); } }; @@ -108,10 +108,10 @@ const handleSuccess = function* handleSuccess({ data }) { goRoom({ item: data, isMasterDetail }); }; -const handleFailure = function handleFailure({ err }) { +const handleFailure = function handleFailure({ err, isTeam }) { setTimeout(() => { - const msg = err.data ? I18n.t(err.data.errorType, { room_name: err.data.details.channel_name }) : err.reason || I18n.t('There_was_an_error_while_action', { action: I18n.t('creating_channel') }); - showErrorAlert(msg); + 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') }); + showErrorAlert(msg, isTeam ? I18n.t('Create_Team') : I18n.t('Create_Channel')); }, 300); };