adjust to js-sdk changes of marking original event as replaced

This commit is contained in:
Bruno Windels 2019-05-15 11:49:43 +01:00
parent edc100163f
commit 5805a88ab9
8 changed files with 11 additions and 5 deletions

View file

@ -526,6 +526,7 @@ module.exports = React.createClass({
<EventTile mxEvent={mxEv} <EventTile mxEvent={mxEv}
continuation={continuation} continuation={continuation}
isRedacted={mxEv.isRedacted()} isRedacted={mxEv.isRedacted()}
replacingEventId={mxEv.replacingEventId()}
onHeightChanged={this._onHeightChanged} onHeightChanged={this._onHeightChanged}
readReceipts={readReceipts} readReceipts={readReceipts}
readReceiptMap={this._readReceiptMap} readReceiptMap={this._readReceiptMap}

View file

@ -507,7 +507,7 @@ const TimelinePanel = React.createClass({
this.forceUpdate(); this.forceUpdate();
}, },
onRoomReplaceEvent: function(replacedEvent, newEvent, room) { onRoomReplaceEvent: function(replacedEvent, room) {
if (this.unmounted) return; if (this.unmounted) return;
// ignore events for other rooms // ignore events for other rooms
@ -515,7 +515,7 @@ const TimelinePanel = React.createClass({
// we could skip an update if the event isn't in our timeline, // we could skip an update if the event isn't in our timeline,
// but that's probably an early optimisation. // but that's probably an early optimisation.
this._reloadEvents(); this.forceUpdate();
}, },
onRoomReceipt: function(ev, room) { onRoomReceipt: function(ev, room) {

View file

@ -118,7 +118,7 @@ export default class MessageEditor extends React.Component {
"m.new_content": newContent, "m.new_content": newContent,
"m.relates_to": { "m.relates_to": {
"rel_type": "m.replace", "rel_type": "m.replace",
"event_id": this.props.event.getOriginalId(), "event_id": this.props.event.getId(),
}, },
}, newContent); }, newContent);

View file

@ -89,6 +89,7 @@ module.exports = React.createClass({
showUrlPreview={this.props.showUrlPreview} showUrlPreview={this.props.showUrlPreview}
tileShape={this.props.tileShape} tileShape={this.props.tileShape}
maxImageHeight={this.props.maxImageHeight} maxImageHeight={this.props.maxImageHeight}
replacingEventId={this.props.replacingEventId}
onHeightChanged={this.props.onHeightChanged} />; onHeightChanged={this.props.onHeightChanged} />;
}, },
}); });

View file

@ -137,6 +137,7 @@ module.exports = React.createClass({
// exploit that events are immutable :) // exploit that events are immutable :)
return (nextProps.mxEvent.getId() !== this.props.mxEvent.getId() || return (nextProps.mxEvent.getId() !== this.props.mxEvent.getId() ||
nextProps.highlights !== this.props.highlights || nextProps.highlights !== this.props.highlights ||
nextProps.replacingEventId !== this.props.replacingEventId ||
nextProps.highlightLink !== this.props.highlightLink || nextProps.highlightLink !== this.props.highlightLink ||
nextProps.showUrlPreview !== this.props.showUrlPreview || nextProps.showUrlPreview !== this.props.showUrlPreview ||
nextState.links !== this.state.links || nextState.links !== this.state.links ||

View file

@ -779,6 +779,7 @@ module.exports = withMatrixClient(React.createClass({
{ thread } { thread }
<EventTileType ref="tile" <EventTileType ref="tile"
mxEvent={this.props.mxEvent} mxEvent={this.props.mxEvent}
replacingEventId={this.props.replacingEventId}
highlights={this.props.highlights} highlights={this.props.highlights}
highlightLink={this.props.highlightLink} highlightLink={this.props.highlightLink}
showUrlPreview={this.props.showUrlPreview} showUrlPreview={this.props.showUrlPreview}

View file

@ -57,9 +57,10 @@ function parseHtmlMessage(html) {
export function parseEvent(event) { export function parseEvent(event) {
const content = event.getContent(); const content = event.getContent();
if (content.format === "org.matrix.custom.html") { if (content.format === "org.matrix.custom.html") {
return parseHtmlMessage(content.formatted_body); return parseHtmlMessage(content.formatted_body || "");
} else { } else {
const lines = content.body.split("\n"); const body = content.body || "";
const lines = body.split("\n");
const parts = lines.reduce((parts, line, i) => { const parts = lines.reduce((parts, line, i) => {
const isLast = i === lines.length - 1; const isLast = i === lines.length - 1;
const text = new PlainPart(line); const text = new PlainPart(line);

View file

@ -45,6 +45,7 @@ export default function shouldHideEvent(ev) {
// Hide redacted events // Hide redacted events
if (ev.isRedacted() && !isEnabled('showRedactions')) return true; if (ev.isRedacted() && !isEnabled('showRedactions')) return true;
if (ev.isRelation("m.replace")) return true;
const eventDiff = memberEventDiff(ev); const eventDiff = memberEventDiff(ev);