1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-12-10 07:22:27 +03:00

make replacements work in e2e rooms

This commit is contained in:
Bruno Windels
2019-05-15 14:54:21 +01:00
parent 5fd001354a
commit 1c1781ce76
2 changed files with 14 additions and 2 deletions

View File

@@ -758,6 +758,10 @@ utils.extend(module.exports.MatrixEvent.prototype, {
if (this.isRedacted()) {
return;
}
if (newEvent.isBeingDecrypted()) {
throw new Error("Trying to replace event when " +
"new content hasn't been decrypted yet");
}
const oldContent = this.getContent();
const newContent = newEvent.getContent()["m.new_content"];
// need to always replace m.relates_to with the old one,