Minor tweaks for removing channels and addExistingChannelView
This commit is contained in:
parent
69ae247329
commit
4761e21de8
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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 [];
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue