Skip to content

Commit

Permalink
use new RoomState method from matrix-org/matrix-js-sdk/pull/435
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Telatynski <[email protected]>
  • Loading branch information
t3chguy committed May 16, 2017
1 parent aff1e14 commit d55f4f9
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/components/views/context_menus/MessageContextMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,18 +132,9 @@ module.exports = React.createClass({
}

const cli = MatrixClientPeg.get();

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 && !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
)) {
if (!eventStatus && room.currentState.maySendRedactionForEvent(this.props.mxEvent, cli.credentials.userId)) {
redactButton = (
<div className="mx_MessageContextMenu_field" onClick={this.onRedactClick}>
Redact
Expand Down

0 comments on commit d55f4f9

Please sign in to comment.