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_app_unable_store": "Unable to open {{store}}",
|
||||||
"Review_this_app": "Review this app",
|
"Review_this_app": "Review this app",
|
||||||
"Remove": "Remove",
|
"Remove": "Remove",
|
||||||
|
"remove": "remove",
|
||||||
"Roles": "Roles",
|
"Roles": "Roles",
|
||||||
"Room_actions": "Room actions",
|
"Room_actions": "Room actions",
|
||||||
"Room_changed_announcement": "Room announcement changed to: {{announcement}} by {{userBy}}",
|
"Room_changed_announcement": "Room announcement changed to: {{announcement}} by {{userBy}}",
|
||||||
|
@ -724,5 +725,6 @@
|
||||||
"Remove_from_Team": "Remove from Team",
|
"Remove_from_Team": "Remove from Team",
|
||||||
"Auto-join": "Auto-join",
|
"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",
|
"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) {
|
if (team.type) {
|
||||||
apiType = this.roomTypeToApiType('p');
|
apiType = this.roomTypeToApiType('p');
|
||||||
} else {
|
} else {
|
||||||
apiType = this.roomTypeToApiType(t);
|
apiType = this.roomTypeToApiType(t || 'c');
|
||||||
}
|
}
|
||||||
if (!apiType) {
|
if (!apiType) {
|
||||||
return [];
|
return [];
|
||||||
|
|
|
@ -748,7 +748,7 @@ const RocketChat = {
|
||||||
},
|
},
|
||||||
addTeamRooms({ rooms, teamId }) {
|
addTeamRooms({ rooms, teamId }) {
|
||||||
const params = {
|
const params = {
|
||||||
rooms: rooms.length ? [...rooms] : [rooms],
|
rooms: Array.isArray(rooms) ? rooms : [rooms],
|
||||||
teamId
|
teamId
|
||||||
};
|
};
|
||||||
// RC 3.13.0
|
// RC 3.13.0
|
||||||
|
|
|
@ -77,7 +77,8 @@ const handleRequest = function* handleRequest({ data }) {
|
||||||
// TODO: Log when adding room to team
|
// TODO: Log when adding room to team
|
||||||
const channels = yield call(addTeamRoom, { rooms: sub.rid, teamId: data.teamId });
|
const channels = yield call(addTeamRoom, { rooms: sub.rid, teamId: data.teamId });
|
||||||
if (channels.success) {
|
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;
|
navigationMethod = Navigation.replace;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.rooms && item.teamId) {
|
if (item.isTeamChannel) {
|
||||||
// TODO: Refactor
|
// TODO: Refactor
|
||||||
Navigation.navigate('TeamChannelsView');
|
Navigation.navigate('TeamChannelsView');
|
||||||
Navigation.push('RoomView', {
|
Navigation.push('RoomView', {
|
||||||
|
@ -23,6 +23,8 @@ const navigate = ({ item, isMasterDetail, ...props }) => {
|
||||||
teamId: item.teamId,
|
teamId: item.teamId,
|
||||||
...props
|
...props
|
||||||
});
|
});
|
||||||
|
} else if (item.rooms) {
|
||||||
|
Navigation.navigate('TeamChannelsView');
|
||||||
} else {
|
} else {
|
||||||
navigationMethod('RoomView', {
|
navigationMethod('RoomView', {
|
||||||
rid: item.roomId || item.rid,
|
rid: item.roomId || item.rid,
|
||||||
|
|
|
@ -149,7 +149,7 @@ class AddExistingChannelView extends React.Component {
|
||||||
const result = await RocketChat.addTeamRooms({ rooms: selected, teamId: this.teamId });
|
const result = await RocketChat.addTeamRooms({ rooms: selected, teamId: this.teamId });
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
this.setState({ loading: false });
|
this.setState({ loading: false });
|
||||||
goRoom({ result, isMasterDetail });
|
goRoom({ item: result, isMasterDetail });
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// TODO: Log error
|
// TODO: Log error
|
||||||
|
|
|
@ -334,7 +334,7 @@ class TeamChannelsView extends React.Component {
|
||||||
style: 'cancel'
|
style: 'cancel'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: I18n.t('Yes_action_it', { action: I18n.t('delete') }),
|
text: I18n.t('Yes_action_it', { action: I18n.t('remove') }),
|
||||||
style: 'destructive',
|
style: 'destructive',
|
||||||
onPress: () => this.removeRoom(item)
|
onPress: () => this.removeRoom(item)
|
||||||
}
|
}
|
||||||
|
@ -348,12 +348,10 @@ class TeamChannelsView extends React.Component {
|
||||||
const { data } = this.state;
|
const { data } = this.state;
|
||||||
const result = await RocketChat.removeTeamRoom({ roomId: item.rid, teamId: this.team.teamId });
|
const result = await RocketChat.removeTeamRoom({ roomId: item.rid, teamId: this.team.teamId });
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
console.log({ result });
|
|
||||||
const newData = data.filter(room => result.room._id !== room.rid);
|
const newData = data.filter(room => result.room._id !== room.rid);
|
||||||
console.log({ newData });
|
|
||||||
this.setState({ loading: true, data: newData }, () => {
|
this.setState({ loading: true, data: newData }, () => {
|
||||||
this.loadTeam();
|
|
||||||
this.load();
|
this.load();
|
||||||
|
this.loadTeam();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
Loading…
Reference in New Issue