send edit also in n.new_content field

so we can have fallback content in the regular content for clients
that don't support edits. Note that we're not reading m.new_content
yet as it's going to be a bit of a headache to change this.

So for now just sending the edit in both the normal content and
the m.new_content subfield, so all events out there already
are well-formed
pull/21833/head
Bruno Windels 2019-05-14 16:32:08 +01:00
parent fd31e793d1
commit dc21faa240
1 changed files with 9 additions and 6 deletions

View File

@ -111,18 +111,21 @@ export default class MessageEditor extends React.Component {
}
_onSaveClicked = () => {
const content = {
const newContent = {
"msgtype": "m.text",
"body": textSerialize(this.model),
};
if (requiresHtml(this.model)) {
newContent.format = "org.matrix.custom.html";
newContent.formatted_body = htmlSerialize(this.model);
}
const content = Object.assign({
"m.new_content": newContent,
"m.relates_to": {
"rel_type": "m.replace",
"event_id": this.props.event.getOriginalId(),
},
};
if (requiresHtml(this.model)) {
content.format = "org.matrix.custom.html";
content.formatted_body = htmlSerialize(this.model);
}
}, newContent);
const roomId = this.props.event.getRoomId();
this.context.matrixClient.sendMessage(roomId, content);