Skip to content

Commit 5392afd

Browse files
committed
Add UI for changing room avatars and update UI when room avatars change
1 parent e844b7a commit 5392afd

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

src/controllers/organisms/RoomList.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ module.exports = {
3333
cli.on("Room", this.onRoom);
3434
cli.on("Room.timeline", this.onRoomTimeline);
3535
cli.on("Room.name", this.onRoomName);
36+
cli.on("RoomState.events", this.onRoomStateEvents);
3637

3738
var rooms = this.getRoomList();
3839
this.setState({
@@ -66,6 +67,7 @@ module.exports = {
6667
MatrixClientPeg.get().removeListener("Room", this.onRoom);
6768
MatrixClientPeg.get().removeListener("Room.timeline", this.onRoomTimeline);
6869
MatrixClientPeg.get().removeListener("Room.name", this.onRoomName);
70+
MatrixClientPeg.get().removeListener("RoomState.events", this.onRoomStateEvents);
6971
}
7072
},
7173

@@ -110,6 +112,11 @@ module.exports = {
110112
this.refreshRoomList();
111113
},
112114

115+
onRoomStateEvents: function(ev, state) {
116+
setTimeout(this.refreshRoomList, 0);
117+
},
118+
119+
113120
refreshRoomList: function() {
114121
var rooms = this.getRoomList();
115122
this.setState({

src/skins/vector/views/atoms/RoomAvatar.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ module.exports = React.createClass({
4444

4545
render: function() {
4646
var style = {
47-
'max-width': this.props.width,
48-
'max-height': this.props.height,
47+
maxWidth: this.props.width,
48+
maxHeight: this.props.height,
4949
};
5050
return (
5151
<img className="mx_RoomAvatar" src={this.state.imageUrl} onError={this.onError}

src/skins/vector/views/molecules/ChangeAvatar.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ module.exports = React.createClass({
4747
if (this.props.room && !this.avatarSet) {
4848
avatarImg = <RoomAvatar room={this.props.room} width='320' height='240' resizeMethod='scale' />;
4949
} else {
50-
avatarImg = <img src={this.state.avatarUrl}/>;
50+
var style = {
51+
maxWidth: 320,
52+
maxHeight: 240,
53+
};
54+
avatarImg = <img src={this.state.avatarUrl} style={style} />;
5155
}
5256

5357
switch (this.state.phase) {

0 commit comments

Comments
 (0)