From abf3945f32344834f27c789b51f92ed3d5eac470 Mon Sep 17 00:00:00 2001 From: Reinaldo Neto <47038980+reinaldonetof@users.noreply.github.com> Date: Fri, 4 Jun 2021 15:40:50 -0300 Subject: [PATCH] [FIX] Show alert `Not allowed` when click on a private channel that you don't be invited before (#3177) * [FIX] Showing only channel you joined * [FIX] How to get the params to mnavigation to other room from TeamChannelList * Show alert Not allowed when trying access private channel that you don't joined Co-authored-by: Diego Mello --- app/views/TeamChannelsView.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/app/views/TeamChannelsView.js b/app/views/TeamChannelsView.js index 82e4ecdc3..40c8c05ac 100644 --- a/app/views/TeamChannelsView.js +++ b/app/views/TeamChannelsView.js @@ -282,21 +282,20 @@ class TeamChannelsView extends React.Component { logEvent(events.TC_GO_ROOM); const { navigation, isMasterDetail } = this.props; try { - let params = {}; - if (item.rid) { - params = item; - } else { - const { room } = await RocketChat.getRoomInfo(item._id); - params = { - rid: item._id, name: RocketChat.getRoomTitle(room), joinCodeRequired: room.joinCodeRequired, t: room.t, teamId: room.teamId - }; - } + const { room } = await RocketChat.getRoomInfo(item._id); + const params = { + rid: item._id, name: RocketChat.getRoomTitle(room), joinCodeRequired: room.joinCodeRequired, t: room.t, teamId: room.teamId + }; if (isMasterDetail) { navigation.pop(); } goRoom({ item: params, isMasterDetail, navigationMethod: navigation.push }); } catch (e) { - // do nothing + if (e.data.error === 'not-allowed') { + showErrorAlert(I18n.t('error-not-allowed')); + } else { + showErrorAlert(e.data.error); + } } }, 1000, true);