diff --git a/app/i18n/locales/en.json b/app/i18n/locales/en.json index 08532be5e..0ef3e03c4 100644 --- a/app/i18n/locales/en.json +++ b/app/i18n/locales/en.json @@ -435,6 +435,7 @@ "Review_app_unable_store": "Unable to open {{store}}", "Review_this_app": "Review this app", "Remove": "Remove", + "remove": "remove", "Roles": "Roles", "Room_actions": "Room actions", "Room_changed_announcement": "Room announcement changed to: {{announcement}} by {{userBy}}", @@ -724,5 +725,6 @@ "Remove_from_Team": "Remove from Team", "Auto-join": "Auto-join", "Delete_Team_Room_Warning": "Woud you like to remove this channel from the team? The channel will be moved back to the workspace", - "Confirmation": "Confirmation" + "Confirmation": "Confirmation", + "invalid-room": "Invalid room" } diff --git a/app/lib/methods/loadMessagesForRoom.js b/app/lib/methods/loadMessagesForRoom.js index 9ab5cf215..9f5aabcab 100644 --- a/app/lib/methods/loadMessagesForRoom.js +++ b/app/lib/methods/loadMessagesForRoom.js @@ -13,7 +13,7 @@ async function load({ if (team.type) { apiType = this.roomTypeToApiType('p'); } else { - apiType = this.roomTypeToApiType(t); + apiType = this.roomTypeToApiType(t || 'c'); } if (!apiType) { return []; diff --git a/app/lib/rocketchat.js b/app/lib/rocketchat.js index d9cfbc201..0d68e9628 100644 --- a/app/lib/rocketchat.js +++ b/app/lib/rocketchat.js @@ -748,7 +748,7 @@ const RocketChat = { }, addTeamRooms({ rooms, teamId }) { const params = { - rooms: rooms.length ? [...rooms] : [rooms], + rooms: Array.isArray(rooms) ? rooms : [rooms], teamId }; // RC 3.13.0 diff --git a/app/sagas/createChannel.js b/app/sagas/createChannel.js index a642cbf89..e02f59ad8 100644 --- a/app/sagas/createChannel.js +++ b/app/sagas/createChannel.js @@ -77,7 +77,8 @@ const handleRequest = function* handleRequest({ data }) { // TODO: Log when adding room to team const channels = yield call(addTeamRoom, { rooms: sub.rid, teamId: data.teamId }); if (channels.success) { - sub.teamId = channels.teamId; + sub.teamId = channels.rooms[0].teamId; + sub.isTeamChannel = true; } } } diff --git a/app/utils/goRoom.js b/app/utils/goRoom.js index 1a421e554..b94acf3fc 100644 --- a/app/utils/goRoom.js +++ b/app/utils/goRoom.js @@ -8,7 +8,7 @@ const navigate = ({ item, isMasterDetail, ...props }) => { navigationMethod = Navigation.replace; } - if (item.rooms && item.teamId) { + if (item.isTeamChannel) { // TODO: Refactor Navigation.navigate('TeamChannelsView'); Navigation.push('RoomView', { @@ -23,6 +23,8 @@ const navigate = ({ item, isMasterDetail, ...props }) => { teamId: item.teamId, ...props }); + } else if (item.rooms) { + Navigation.navigate('TeamChannelsView'); } else { navigationMethod('RoomView', { rid: item.roomId || item.rid, diff --git a/app/views/AddExistingChannelView.js b/app/views/AddExistingChannelView.js index c29993057..62d2263ec 100644 --- a/app/views/AddExistingChannelView.js +++ b/app/views/AddExistingChannelView.js @@ -149,7 +149,7 @@ class AddExistingChannelView extends React.Component { const result = await RocketChat.addTeamRooms({ rooms: selected, teamId: this.teamId }); if (result.success) { this.setState({ loading: false }); - goRoom({ result, isMasterDetail }); + goRoom({ item: result, isMasterDetail }); } } catch (e) { // TODO: Log error diff --git a/app/views/TeamChannelsView.js b/app/views/TeamChannelsView.js index b329cacc0..70b8c2c44 100644 --- a/app/views/TeamChannelsView.js +++ b/app/views/TeamChannelsView.js @@ -334,7 +334,7 @@ class TeamChannelsView extends React.Component { style: 'cancel' }, { - text: I18n.t('Yes_action_it', { action: I18n.t('delete') }), + text: I18n.t('Yes_action_it', { action: I18n.t('remove') }), style: 'destructive', onPress: () => this.removeRoom(item) } @@ -348,12 +348,10 @@ class TeamChannelsView extends React.Component { const { data } = this.state; const result = await RocketChat.removeTeamRoom({ roomId: item.rid, teamId: this.team.teamId }); if (result.success) { - console.log({ result }); const newData = data.filter(room => result.room._id !== room.rid); - console.log({ newData }); this.setState({ loading: true, data: newData }, () => { - this.loadTeam(); this.load(); + this.loadTeam(); }); } } catch (e) {