Update pinned messages in real time
Fixes https://github.com/vector-im/riot-web/issues/5358 Signed-off-by: Travis Ralston <travpc@gmail.com>pull/21833/head
parent
bbdc27019a
commit
085271a864
|
@ -39,6 +39,19 @@ module.exports = React.createClass({
|
|||
|
||||
componentDidMount: function() {
|
||||
this._updatePinnedMessages();
|
||||
MatrixClientPeg.get().on("RoomState.events", this._onEvent);
|
||||
},
|
||||
|
||||
componentWillUnmount: function() {
|
||||
if (MatrixClientPeg.get()) {
|
||||
MatrixClientPeg.get().removeListener("RoomState.events", this._onEvent);
|
||||
}
|
||||
},
|
||||
|
||||
_onEvent: function(ev) {
|
||||
if (ev.getRoomId() === this.props.room.roomId && ev.getType() === "m.room.pinned_events") {
|
||||
this._updatePinnedMessages();
|
||||
}
|
||||
},
|
||||
|
||||
_updatePinnedMessages: function() {
|
||||
|
|
Loading…
Reference in New Issue