use new RoomState method from matrix-org/matrix-js-sdk/pull/435

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
pull/3925/head
Michael Telatynski 2017-05-16 14:08:00 +01:00
parent aff1e14efc
commit d55f4f9e6a
1 changed files with 1 additions and 10 deletions

View File

@ -132,18 +132,9 @@ module.exports = React.createClass({
} }
const cli = MatrixClientPeg.get(); const cli = MatrixClientPeg.get();
const room = cli.getRoom(this.props.mxEvent.getRoomId()); const room = cli.getRoom(this.props.mxEvent.getRoomId());
const powerLevelEvents = room.currentState.getStateEvents('m.room.power_levels', '');
const powerLevels = powerLevelEvents ? powerLevelEvents.getContent() : {};
const userLevels = powerLevels.users || {};
const userLevel = userLevels[cli.credentials.userId] || parseIntWithDefault(powerLevels.users_default, 0); if (!eventStatus && room.currentState.maySendRedactionForEvent(this.props.mxEvent, cli.credentials.userId)) {
if (!eventStatus && !this.props.mxEvent.isRedacted() && (// sent and not redacted
this.props.mxEvent.getSender() === cli.credentials.userId // own event
|| userLevel >= parseIntWithDefault(powerLevels.redact, 50) // has PL to redact
)) {
redactButton = ( redactButton = (
<div className="mx_MessageContextMenu_field" onClick={this.onRedactClick}> <div className="mx_MessageContextMenu_field" onClick={this.onRedactClick}>
Redact Redact