Listen for reaction collections when they are created
The `EventTile` for events without reactions now use `Event.relationsCreated` to listen for a future time where they come in to being.
This commit is contained in:
parent
ce35741030
commit
37d2f60045
1 changed files with 16 additions and 2 deletions
|
@ -193,9 +193,12 @@ module.exports = withMatrixClient(React.createClass({
|
||||||
|
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
this._suppressReadReceiptAnimation = false;
|
this._suppressReadReceiptAnimation = false;
|
||||||
this.props.matrixClient.on("deviceVerificationChanged",
|
const client = this.props.matrixClient;
|
||||||
this.onDeviceVerificationChanged);
|
client.on("deviceVerificationChanged", this.onDeviceVerificationChanged);
|
||||||
this.props.mxEvent.on("Event.decrypted", this._onDecrypted);
|
this.props.mxEvent.on("Event.decrypted", this._onDecrypted);
|
||||||
|
if (SettingsStore.isFeatureEnabled("feature_reactions")) {
|
||||||
|
this.props.mxEvent.on("Event.relationsCreated", this._onReactionsCreated);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillReceiveProps: function(nextProps) {
|
componentWillReceiveProps: function(nextProps) {
|
||||||
|
@ -218,6 +221,9 @@ module.exports = withMatrixClient(React.createClass({
|
||||||
const client = this.props.matrixClient;
|
const client = this.props.matrixClient;
|
||||||
client.removeListener("deviceVerificationChanged", this.onDeviceVerificationChanged);
|
client.removeListener("deviceVerificationChanged", this.onDeviceVerificationChanged);
|
||||||
this.props.mxEvent.removeListener("Event.decrypted", this._onDecrypted);
|
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.
|
/** 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");
|
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() {
|
render: function() {
|
||||||
const MessageTimestamp = sdk.getComponent('messages.MessageTimestamp');
|
const MessageTimestamp = sdk.getComponent('messages.MessageTimestamp');
|
||||||
const SenderProfile = sdk.getComponent('messages.SenderProfile');
|
const SenderProfile = sdk.getComponent('messages.SenderProfile');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue