[FIX] RoomInfoView displaying different info depending on the origin (#3586)
Co-authored-by: GleidsonDaniel <gleidson10daniel@hotmail.com>
This commit is contained in:
parent
cd9ce58660
commit
bff99d5c0b
|
@ -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 {
|
||||||
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 {
|
||||||
} 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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue