Merge pull request #1934 from turt2live/travis/realtime-pins

Update pinned messages in real time
This commit is contained in:
Michael Telatynski 2018-05-27 17:50:23 +01:00 committed by GitHub
commit 96ec3ab78a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -39,6 +39,19 @@ module.exports = React.createClass({
componentDidMount: function() { componentDidMount: function() {
this._updatePinnedMessages(); this._updatePinnedMessages();
MatrixClientPeg.get().on("RoomState.events", this._onStateEvent);
},
componentWillUnmount: function() {
if (MatrixClientPeg.get()) {
MatrixClientPeg.get().removeListener("RoomState.events", this._onStateEvent);
}
},
_onStateEvent: function(ev) {
if (ev.getRoomId() === this.props.room.roomId && ev.getType() === "m.room.pinned_events") {
this._updatePinnedMessages();
}
}, },
_updatePinnedMessages: function() { _updatePinnedMessages: function() {