From b7396c8ef00e9524b7d465dcd037c054f31353c9 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 22 Jun 2018 19:17:55 +0100 Subject: [PATCH] trigger urlPreviews state update on {,room}AccountData changes of settings Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/RoomView.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index af994d298f..c6dcc556be 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -648,19 +648,23 @@ module.exports = React.createClass({ }, onAccountData: function(event) { - if (event.getType() === "org.matrix.preview_urls" && this.state.room) { + const type = event.getType(); + if ((type === "org.matrix.preview_urls" || type === "im.vector.web.settings") && this.state.room) { + // non-e2ee url previews are stored in legacy event type `org.matrix.room.preview_urls` this._updatePreviewUrlVisibility(this.state.room); } }, onRoomAccountData: function(event, room) { if (room.roomId == this.state.roomId) { - if (event.getType() === "org.matrix.room.color_scheme") { + const type = event.getType(); + if (type === "org.matrix.room.color_scheme") { const color_scheme = event.getContent(); // XXX: we should validate the event console.log("Tinter.tint from onRoomAccountData"); Tinter.tint(color_scheme.primary_color, color_scheme.secondary_color); - } else if (event.getType() === "org.matrix.room.preview_urls") { + } else if (type === "org.matrix.room.preview_urls" || type === "im.vector.web.settings") { + // non-e2ee url previews are stored in legacy event type `org.matrix.room.preview_urls` this._updatePreviewUrlVisibility(room); } }