From 16846c36fd8d878f4465bca4553ce465dd3221c0 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 21 Jul 2015 14:46:42 +0100 Subject: [PATCH] Handle default named rooms when editing room names --- skins/base/views/molecules/RoomHeader.js | 8 +++++--- skins/base/views/organisms/RoomView.js | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/skins/base/views/molecules/RoomHeader.js b/skins/base/views/molecules/RoomHeader.js index fdf4d7e52f..e08f2651c8 100644 --- a/skins/base/views/molecules/RoomHeader.js +++ b/skins/base/views/molecules/RoomHeader.js @@ -28,7 +28,7 @@ module.exports = React.createClass({ mixins: [RoomHeaderController], onNameChange: function(new_name) { - if (this.props.room.name != new_name) { + if (this.props.room.name != new_name && new_name) { MatrixClientPeg.get().setRoomName(this.props.room.roomId, new_name); } }, @@ -69,8 +69,10 @@ module.exports = React.createClass({ var topic_el = null; var save_button = null; var settings_button = null; + var actual_name = this.props.room.currentState.getStateEvents('m.room.name', ''); + if (actual_name) actual_name = actual_name.getContent().name; if (this.props.editing) { - name = ; + name = ; // if (topic) topic_el =
save_button = (
@@ -78,7 +80,7 @@ module.exports = React.createClass({
); } else { - name = ; + name = ; if (topic) topic_el =
{ topic.getContent().topic }
; settings_button = (
diff --git a/skins/base/views/organisms/RoomView.js b/skins/base/views/organisms/RoomView.js index 124f74cdaf..ffd7bad5a4 100644 --- a/skins/base/views/organisms/RoomView.js +++ b/skins/base/views/organisms/RoomView.js @@ -83,7 +83,7 @@ module.exports = React.createClass({ var deferreds = []; - if (old_name != new_name && new_name != undefined) { + if (old_name != new_name && new_name != undefined && new_name) { deferreds.push( MatrixClientPeg.get().setRoomName(this.state.room.roomId, new_name) );