mirror of https://github.com/vector-im/riot-web
Merge pull request #4182 from matrix-org/travis/edit-redactions
Disable edits on redacted eventspull/21833/head
commit
1530c91772
|
@ -121,10 +121,12 @@ export default class MessageActionBar extends React.PureComponent {
|
|||
|
||||
componentDidMount() {
|
||||
this.props.mxEvent.on("Event.decrypted", this.onDecrypted);
|
||||
this.props.mxEvent.on("Event.beforeRedaction", this.onBeforeRedaction);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
this.props.mxEvent.removeListener("Event.decrypted", this.onDecrypted);
|
||||
this.props.mxEvent.removeListener("Event.beforeRedaction", this.onBeforeRedaction);
|
||||
}
|
||||
|
||||
onDecrypted = () => {
|
||||
|
@ -133,6 +135,11 @@ export default class MessageActionBar extends React.PureComponent {
|
|||
this.forceUpdate();
|
||||
};
|
||||
|
||||
onBeforeRedaction = () => {
|
||||
// When an event is redacted, we can't edit it so update the available actions.
|
||||
this.forceUpdate();
|
||||
};
|
||||
|
||||
onFocusChange = (focused) => {
|
||||
if (!this.props.onFocusChange) {
|
||||
return;
|
||||
|
|
|
@ -46,7 +46,7 @@ export function isContentActionable(mxEvent) {
|
|||
}
|
||||
|
||||
export function canEditContent(mxEvent) {
|
||||
if (mxEvent.status === EventStatus.CANCELLED || mxEvent.getType() !== "m.room.message") {
|
||||
if (mxEvent.status === EventStatus.CANCELLED || mxEvent.getType() !== "m.room.message" || mxEvent.isRedacted()) {
|
||||
return false;
|
||||
}
|
||||
const content = mxEvent.getOriginalContent();
|
||||
|
|
Loading…
Reference in New Issue