You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-08-04 23:02:14 +03:00
Merge pull request #272 from matrix-org/rav/fix_roomname
Make sure that we update the room name
This commit is contained in:
@@ -53,6 +53,13 @@ module.exports = React.createClass({
|
|||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
var cli = MatrixClientPeg.get();
|
var cli = MatrixClientPeg.get();
|
||||||
cli.on("RoomState.events", this._onRoomStateEvents);
|
cli.on("RoomState.events", this._onRoomStateEvents);
|
||||||
|
|
||||||
|
// When a room name occurs, RoomState.events is fired *before*
|
||||||
|
// room.name is updated. So we have to listen to Room.name as well as
|
||||||
|
// RoomState.events.
|
||||||
|
if (this.props.room) {
|
||||||
|
this.props.room.on("Room.name", this._onRoomNameChange);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
componentDidUpdate: function() {
|
componentDidUpdate: function() {
|
||||||
@@ -62,6 +69,9 @@ module.exports = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
componentWillUnmount: function() {
|
componentWillUnmount: function() {
|
||||||
|
if (this.props.room) {
|
||||||
|
this.props.room.removeListener("Room.name", this._onRoomNameChange);
|
||||||
|
}
|
||||||
var cli = MatrixClientPeg.get();
|
var cli = MatrixClientPeg.get();
|
||||||
if (cli) {
|
if (cli) {
|
||||||
cli.removeListener("RoomState.events", this._onRoomStateEvents);
|
cli.removeListener("RoomState.events", this._onRoomStateEvents);
|
||||||
@@ -77,6 +87,10 @@ module.exports = React.createClass({
|
|||||||
this.forceUpdate();
|
this.forceUpdate();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_onRoomNameChange: function(room) {
|
||||||
|
this.forceUpdate();
|
||||||
|
},
|
||||||
|
|
||||||
onAvatarPickerClick: function(ev) {
|
onAvatarPickerClick: function(ev) {
|
||||||
if (this.refs.file_label) {
|
if (this.refs.file_label) {
|
||||||
this.refs.file_label.click();
|
this.refs.file_label.click();
|
||||||
|
Reference in New Issue
Block a user