Unverified Commit bff99d5c authored by Reinaldo Neto's avatar Reinaldo Neto Committed by GitHub
Browse files

[FIX] RoomInfoView displaying different info depending on the origin (#3586)



Co-authored-by: default avatarGleidsonDaniel <gleidson10daniel@hotmail.com>
parent cd9ce586
...@@ -178,6 +178,14 @@ class RoomInfoView extends React.Component { ...@@ -178,6 +178,14 @@ class RoomInfoView extends React.Component {
} }
}; };
parseRoles = roleArray =>
Promise.all(
roleArray.map(async role => {
const description = await this.getRoleDescription(role);
return description;
})
);
loadUser = async () => { loadUser = async () => {
const { room, roomUser } = this.state; const { room, roomUser } = this.state;
...@@ -189,12 +197,7 @@ class RoomInfoView extends React.Component { ...@@ -189,12 +197,7 @@ class RoomInfoView extends React.Component {
const { user } = result; const { user } = result;
const { roles } = user; const { roles } = user;
if (roles && roles.length) { if (roles && roles.length) {
user.parsedRoles = await Promise.all( user.parsedRoles = await this.parseRoles(roles);
roles.map(async role => {
const description = await this.getRoleDescription(role);
return description;
})
);
} }
this.setState({ roomUser: user }); this.setState({ roomUser: user });
...@@ -202,6 +205,18 @@ class RoomInfoView extends React.Component { ...@@ -202,6 +205,18 @@ class RoomInfoView extends React.Component {
} catch { } catch {
// do nothing // do nothing
} }
} else {
try {
const { roles } = roomUser;
if (roles && roles.length) {
const parsedRoles = await this.parseRoles(roles);
this.setState({ roomUser: { ...roomUser, parsedRoles } });
} else {
this.setState({ roomUser });
}
} catch (e) {
// do nothing
}
} }
}; };
......
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