diff --git a/src/components/views/rooms/EventTile.js b/src/components/views/rooms/EventTile.js index d40dd5a77c..5a5aaeb098 100644 --- a/src/components/views/rooms/EventTile.js +++ b/src/components/views/rooms/EventTile.js @@ -193,9 +193,12 @@ module.exports = withMatrixClient(React.createClass({ componentDidMount: function() { this._suppressReadReceiptAnimation = false; - this.props.matrixClient.on("deviceVerificationChanged", - this.onDeviceVerificationChanged); + const client = this.props.matrixClient; + client.on("deviceVerificationChanged", this.onDeviceVerificationChanged); this.props.mxEvent.on("Event.decrypted", this._onDecrypted); + if (SettingsStore.isFeatureEnabled("feature_reactions")) { + this.props.mxEvent.on("Event.relationsCreated", this._onReactionsCreated); + } }, componentWillReceiveProps: function(nextProps) { @@ -218,6 +221,9 @@ module.exports = withMatrixClient(React.createClass({ const client = this.props.matrixClient; client.removeListener("deviceVerificationChanged", this.onDeviceVerificationChanged); this.props.mxEvent.removeListener("Event.decrypted", this._onDecrypted); + if (SettingsStore.isFeatureEnabled("feature_reactions")) { + this.props.mxEvent.removeListener("Event.relationsCreated", this._onReactionsCreated); + } }, /** called when the event is decrypted after we show it. @@ -486,6 +492,14 @@ module.exports = withMatrixClient(React.createClass({ return this.props.getRelationsForEvent(eventId, "m.annotation", "m.reaction"); }, + _onReactionsCreated(relationType, eventType) { + if (relationType !== "m.annotation" || eventType !== "m.reaction") { + return; + } + this.props.mxEvent.removeListener("Event.relationsCreated", this._onReactionsCreated); + this.forceUpdate(); + }, + render: function() { const MessageTimestamp = sdk.getComponent('messages.MessageTimestamp'); const SenderProfile = sdk.getComponent('messages.SenderProfile');