Merge branch 'develop' into matthew/scalar

This commit is contained in:
Matthew Hodgson 2016-06-19 22:40:58 +01:00
commit 4dfb0e9a90
14 changed files with 220 additions and 74 deletions

View file

@ -81,16 +81,18 @@ module.exports = React.createClass({
// });
},
showRoom: function(roomId) {
showRoom: function(roomId, roomAlias) {
// extract the metadata from the publicRooms structure to pass
// as out-of-band data to view_room, because we get information
// here that we can't get other than by joining the room in some
// cases.
var room;
for (var i = 0; i < this.state.publicRooms.length; ++i) {
if (this.state.publicRooms[i].room_id == roomId) {
room = this.state.publicRooms[i];
break;
if (roomId) {
for (var i = 0; i < this.state.publicRooms.length; ++i) {
if (this.state.publicRooms[i].room_id == roomId) {
room = this.state.publicRooms[i];
break;
}
}
}
var oob_data = {};
@ -114,11 +116,20 @@ module.exports = React.createClass({
};
}
dis.dispatch({
action: 'view_room',
room_id: roomId,
var payload = {
oob_data: oob_data,
});
action: 'view_room',
};
// It's not really possible to join Matrix rooms by ID because the HS has no way to know
// which servers to start querying. However, there's no other way to join rooms in
// this list without aliases at present, so if roomAlias isn't set here we have no
// choice but to supply the ID.
if (roomAlias) {
payload.room_alias = roomAlias;
} else {
payload.room_id = roomId;
}
dis.dispatch(payload);
},
getRows: function(filter) {
@ -164,7 +175,7 @@ module.exports = React.createClass({
topic = linkifyString(sanitizeHtml(topic));
rows.unshift(
<tr key={ rooms[i].room_id } onClick={self.showRoom.bind(null, rooms[i].room_id)}>
<tr key={ rooms[i].room_id } onClick={self.showRoom.bind(null, rooms[i].room_id, alias)}>
<td className="mx_RoomDirectory_roomAvatar">
<BaseAvatar width={24} height={24} resizeMethod='crop'
name={ name } idName={ name }
@ -193,7 +204,7 @@ module.exports = React.createClass({
this.forceUpdate();
this.setState({ roomAlias : this.refs.roomAlias.value })
if (ev.key == "Enter") {
this.showRoom(this.refs.roomAlias.value);
this.showRoom(null, this.refs.roomAlias.value);
}
},

View file

@ -103,7 +103,7 @@ module.exports = React.createClass({
className="mx_SearchBox_search"
value={ this.state.searchTerm }
onChange={ this.onChange }
placeholder="Search room names"
placeholder="Filter room names"
/>
];
}

View file

@ -21,7 +21,6 @@ var sdk = require('matrix-react-sdk');
var MatrixClientPeg = require('matrix-react-sdk/lib/MatrixClientPeg');
var UserSettingsStore = require('matrix-react-sdk/lib/UserSettingsStore');
var Modal = require('matrix-react-sdk/lib/Modal');
var configJson = require("../../../../config.json");
var notifications = require('../../../notifications');
@ -73,6 +72,8 @@ module.exports = React.createClass({
propTypes: {
// The array of threepids from the JS SDK (required for email notifications)
threepids: React.PropTypes.array.isRequired,
// The brand string set when creating an email pusher
brand: React.PropTypes.string,
},
getDefaultProps: function() {
@ -118,9 +119,7 @@ module.exports = React.createClass({
var emailPusherPromise;
if (event.target.checked) {
var data = {}
if (configJson.brand) {
data['brand'] = configJson.brand;
}
data['brand'] = this.props.brand || 'Vector';
emailPusherPromise = UserSettingsStore.addEmailPusher(address, data);
} else {
var emailPusher = UserSettingsStore.getEmailPusher(this.state.pushers, address);