diff --git a/app/actions/createChannel.js b/app/actions/createChannel.js index 60a8cca3..c93b47ef 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/i18n/locales/en.json b/app/i18n/locales/en.json index 71403821..76d60f21 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 64369e78..7eca8b04 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/sagas/createChannel.js b/app/sagas/createChannel.js index 8979e230..a768916c 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.error) : 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); }; diff --git a/app/views/AddExistingChannelView.js b/app/views/AddExistingChannelView.js index 03cfaa4f..c1c94fec 100644 --- a/app/views/AddExistingChannelView.js +++ b/app/views/AddExistingChannelView.js @@ -20,6 +20,7 @@ import SafeAreaView from '../containers/SafeAreaView'; import Loading from '../containers/Loading'; import { animateNextTransition } from '../utils/layoutAnimation'; import { goRoom } from '../utils/goRoom'; +import { showErrorAlert } from '../utils/info'; import debounce from '../utils/debounce'; const QUERY_SIZE = 50; @@ -125,6 +126,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 }); }