mirror of https://github.com/vector-im/riot-web
Show nearest lower badge, e.g show Mod for 51... etc
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>pull/21833/head
parent
150c941340
commit
93323421de
|
@ -139,11 +139,21 @@ module.exports = React.createClass({
|
||||||
}
|
}
|
||||||
this.member_last_modified_time = member.getLastModifiedTime();
|
this.member_last_modified_time = member.getLastModifiedTime();
|
||||||
|
|
||||||
// We deliberately leave power levels that are not 100 or 50 undefined
|
const powerStatusMap = new Map([
|
||||||
const powerStatus = {
|
[100, EntityTile.POWER_STATUS_ADMIN],
|
||||||
100: EntityTile.POWER_STATUS_ADMIN,
|
[50, EntityTile.POWER_STATUS_MODERATOR],
|
||||||
50: EntityTile.POWER_STATUS_MODERATOR,
|
]);
|
||||||
}[this.props.member.powerLevel];
|
|
||||||
|
// Find the nearest power level with a badge
|
||||||
|
let powerLevel = this.props.member.powerLevel;
|
||||||
|
for (const [pl] of powerStatusMap) {
|
||||||
|
if (this.props.member.powerLevel >= pl) {
|
||||||
|
powerLevel = pl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const powerStatus = powerStatusMap.get(powerLevel);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<EntityTile {...this.props} presenceState={presenceState}
|
<EntityTile {...this.props} presenceState={presenceState}
|
||||||
|
|
Loading…
Reference in New Issue