From d55f4f9e6a3e3a3e1230d97132b22c9ea1aa14c6 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 16 May 2017 14:08:00 +0100 Subject: [PATCH] use new RoomState method from matrix-org/matrix-js-sdk/pull/435 Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- .../views/context_menus/MessageContextMenu.js | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/components/views/context_menus/MessageContextMenu.js b/src/components/views/context_menus/MessageContextMenu.js index 0f750c10..1fab91dd 100644 --- a/src/components/views/context_menus/MessageContextMenu.js +++ b/src/components/views/context_menus/MessageContextMenu.js @@ -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 = (
Redact