Unverified Commit ccdbd954 authored by Alex Junior's avatar Alex Junior Committed by GitHub
Browse files

Chore: Migrate REST API - getRoomInfo to Typescript (#3823)

* chore: add rest api return

* chore: add rest api return
parent 1aab65ef
......@@ -157,23 +157,25 @@ class DirectoryView extends React.Component<IDirectoryViewProps, any> {
this.goRoom({ rid: result.room._id, name: item.username, t: 'd' });
}
} else if (['p', 'c'].includes(item.t) && !item.teamMain) {
const { room }: any = await RocketChat.getRoomInfo(item._id);
this.goRoom({
rid: item._id,
name: item.name,
joinCodeRequired: room.joinCodeRequired,
t: item.t,
search: true
});
} else {
this.goRoom({
rid: item._id,
name: item.name,
t: item.t,
search: true,
teamMain: item.teamMain,
teamId: item.teamId
});
const result = await RocketChat.getRoomInfo(item._id);
if (result.success) {
this.goRoom({
rid: item._id,
name: item.name,
joinCodeRequired: result.room.joinCodeRequired,
t: item.t,
search: true
});
} else {
this.goRoom({
rid: item._id,
name: item.name,
t: item.t,
search: true,
teamMain: item.teamMain,
teamId: item.teamId
});
}
}
};
......
......@@ -350,14 +350,17 @@ class TeamChannelsView extends React.Component<ITeamChannelsViewProps, ITeamChan
logEvent(events.TC_GO_ROOM);
const { navigation, isMasterDetail } = this.props;
try {
const { room } = (await RocketChat.getRoomInfo(item._id)) as any;
const params = {
rid: item._id,
name: RocketChat.getRoomTitle(room),
joinCodeRequired: room.joinCodeRequired,
t: room.t,
teamId: room.teamId
};
let params = {};
const result = await RocketChat.getRoomInfo(item._id);
if (result.success) {
params = {
rid: item._id,
name: RocketChat.getRoomTitle(result.room),
joinCodeRequired: result.room.joinCodeRequired,
t: result.room.t,
teamId: result.room.teamId
};
}
if (isMasterDetail) {
navigation.pop();
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment