From b10aa269d2e3365bb0f91adeeb36abd0c56dc21f Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Sat, 1 Jun 2019 18:32:17 +0200 Subject: [PATCH] very quick emote support --- src/domain/session/room/timeline/tiles/TextTile.js | 7 ++++++- src/domain/session/room/timeline/tilesCreator.js | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/domain/session/room/timeline/tiles/TextTile.js b/src/domain/session/room/timeline/tiles/TextTile.js index 411b1a55..092ff889 100644 --- a/src/domain/session/room/timeline/tiles/TextTile.js +++ b/src/domain/session/room/timeline/tiles/TextTile.js @@ -3,6 +3,11 @@ import MessageTile from "./MessageTile.js"; export default class TextTile extends MessageTile { get text() { const content = this._getContent(); - return content && content.body; + const body = content && content.body; + if (this._entry.type() === "m.emote") { + return `* ${this._entry.event.sender} ${body}`; + } else { + return body; + } } } diff --git a/src/domain/session/room/timeline/tilesCreator.js b/src/domain/session/room/timeline/tilesCreator.js index 732e0ce6..96638aa0 100644 --- a/src/domain/session/room/timeline/tilesCreator.js +++ b/src/domain/session/room/timeline/tilesCreator.js @@ -19,6 +19,7 @@ export default function ({timeline, emitUpdate}) { switch (msgtype) { case "m.text": case "m.notice": + case "m.emote": return new TextTile(options); case "m.image": return new ImageTile(options);