From b309ebf99d146f4ebf5ae7dff65135d7762f4776 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Mon, 3 Jun 2019 16:29:16 +0100 Subject: [PATCH] Allow source tile handler for replacements If the debugging mode of showing hidden events in the timeline is enabled, we should also show replacements using the same view source tile as we do for reactions. This allows easy debugging of replacement event data and also makes the edit event look visually distinct from regular messages. Fixes https://github.com/vector-im/riot-web/issues/9937 --- src/components/views/rooms/EventTile.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/components/views/rooms/EventTile.js b/src/components/views/rooms/EventTile.js index 78e98a8133..ce4becbd9d 100644 --- a/src/components/views/rooms/EventTile.js +++ b/src/components/views/rooms/EventTile.js @@ -520,13 +520,20 @@ module.exports = withMatrixClient(React.createClass({ const eventType = this.props.mxEvent.getType(); // Info messages are basically information about commands processed on a room - const isInfoMessage = ( + let isInfoMessage = ( eventType !== 'm.room.message' && eventType !== 'm.sticker' && eventType != 'm.room.create' ); let tileHandler = getHandlerTile(this.props.mxEvent); - if (!tileHandler && SettingsStore.getValue("showHiddenEventsInTimeline")) { + // If we're showing hidden events in the timeline, we should use the + // source tile when there's no regular tile for an event and also for + // replace relations (which otherwise would display as a confusing + // duplicate of the thing they are replacing). + const useSource = !tileHandler || this.props.mxEvent.isRelation("m.replace"); + if (useSource && SettingsStore.getValue("showHiddenEventsInTimeline")) { tileHandler = "messages.ViewSourceEvent"; + // Reuse info message avatar and sender profile styling + isInfoMessage = true; } // This shouldn't happen: the caller should check we support this type // before trying to instantiate us