Add UI for changing room avatars and update UI when room avatars change
This commit is contained in:
parent
e844b7aa21
commit
5392afdec4
|
@ -33,6 +33,7 @@ module.exports = {
|
||||||
cli.on("Room", this.onRoom);
|
cli.on("Room", this.onRoom);
|
||||||
cli.on("Room.timeline", this.onRoomTimeline);
|
cli.on("Room.timeline", this.onRoomTimeline);
|
||||||
cli.on("Room.name", this.onRoomName);
|
cli.on("Room.name", this.onRoomName);
|
||||||
|
cli.on("RoomState.events", this.onRoomStateEvents);
|
||||||
|
|
||||||
var rooms = this.getRoomList();
|
var rooms = this.getRoomList();
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -66,6 +67,7 @@ module.exports = {
|
||||||
MatrixClientPeg.get().removeListener("Room", this.onRoom);
|
MatrixClientPeg.get().removeListener("Room", this.onRoom);
|
||||||
MatrixClientPeg.get().removeListener("Room.timeline", this.onRoomTimeline);
|
MatrixClientPeg.get().removeListener("Room.timeline", this.onRoomTimeline);
|
||||||
MatrixClientPeg.get().removeListener("Room.name", this.onRoomName);
|
MatrixClientPeg.get().removeListener("Room.name", this.onRoomName);
|
||||||
|
MatrixClientPeg.get().removeListener("RoomState.events", this.onRoomStateEvents);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -110,6 +112,11 @@ module.exports = {
|
||||||
this.refreshRoomList();
|
this.refreshRoomList();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onRoomStateEvents: function(ev, state) {
|
||||||
|
setTimeout(this.refreshRoomList, 0);
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
refreshRoomList: function() {
|
refreshRoomList: function() {
|
||||||
var rooms = this.getRoomList();
|
var rooms = this.getRoomList();
|
||||||
this.setState({
|
this.setState({
|
||||||
|
|
|
@ -44,8 +44,8 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
var style = {
|
var style = {
|
||||||
'max-width': this.props.width,
|
maxWidth: this.props.width,
|
||||||
'max-height': this.props.height,
|
maxHeight: this.props.height,
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<img className="mx_RoomAvatar" src={this.state.imageUrl} onError={this.onError}
|
<img className="mx_RoomAvatar" src={this.state.imageUrl} onError={this.onError}
|
||||||
|
|
|
@ -47,7 +47,11 @@ module.exports = React.createClass({
|
||||||
if (this.props.room && !this.avatarSet) {
|
if (this.props.room && !this.avatarSet) {
|
||||||
avatarImg = <RoomAvatar room={this.props.room} width='320' height='240' resizeMethod='scale' />;
|
avatarImg = <RoomAvatar room={this.props.room} width='320' height='240' resizeMethod='scale' />;
|
||||||
} else {
|
} else {
|
||||||
avatarImg = <img src={this.state.avatarUrl}/>;
|
var style = {
|
||||||
|
maxWidth: 320,
|
||||||
|
maxHeight: 240,
|
||||||
|
};
|
||||||
|
avatarImg = <img src={this.state.avatarUrl} style={style} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (this.state.phase) {
|
switch (this.state.phase) {
|
||||||
|
|
Loading…
Reference in New Issue