Pass room and user id to apps draw

pull/21833/head
Richard Lewis 2017-06-05 18:21:31 +01:00
parent c6991fd33c
commit dc4f321707
4 changed files with 37 additions and 5 deletions

View File

@ -122,6 +122,7 @@ module.exports = React.createClass({
return { return {
room: null, room: null,
roomId: null, roomId: null,
userId: null,
roomLoading: true, roomLoading: true,
editingRoomSettings: false, editingRoomSettings: false,
uploadingRoomSettings: false, uploadingRoomSettings: false,
@ -185,6 +186,7 @@ module.exports = React.createClass({
this.setState({ this.setState({
room: room, room: room,
roomId: result.room_id, roomId: result.room_id,
userId: MatrixClientPeg.get().credentials.userId,
roomLoading: !room, roomLoading: !room,
unsentMessageError: this._getUnsentMessageError(room), unsentMessageError: this._getUnsentMessageError(room),
}, this._onHaveRoom); }, this._onHaveRoom);
@ -198,6 +200,7 @@ module.exports = React.createClass({
var room = MatrixClientPeg.get().getRoom(this.props.roomAddress); var room = MatrixClientPeg.get().getRoom(this.props.roomAddress);
this.setState({ this.setState({
roomId: this.props.roomAddress, roomId: this.props.roomAddress,
userId: MatrixClientPeg.get().credentials.userId,
room: room, room: room,
roomLoading: !room, roomLoading: !room,
unsentMessageError: this._getUnsentMessageError(room), unsentMessageError: this._getUnsentMessageError(room),
@ -1640,6 +1643,7 @@ module.exports = React.createClass({
var auxPanel = ( var auxPanel = (
<AuxPanel ref="auxPanel" room={this.state.room} <AuxPanel ref="auxPanel" room={this.state.room}
userId={this.state.userId}
conferenceHandler={this.props.ConferenceHandler} conferenceHandler={this.props.ConferenceHandler}
draggingFile={this.state.draggingFile} draggingFile={this.state.draggingFile}
displayConfCallNotification={this.state.displayConfCallNotification} displayConfCallNotification={this.state.displayConfCallNotification}

View File

@ -74,8 +74,7 @@ export default React.createClass({
</span> </span>
</div> </div>
<div className="mx_AppTileBody"> <div className="mx_AppTileBody">
{/* <iframe sandbox="sandbox" seamless="seamless" src={this.props.url}></iframe> */} <iframe ref="appFrame" src={this.props.url}></iframe>
<iframe ref="appFrame" seamless="seamless" src={this.props.url}></iframe>
</div> </div>
</div> </div>
); );

View File

@ -44,7 +44,7 @@ const roomWidgetConfig = {
name: "Monitoring our Single-Point-Of-Failure DB", name: "Monitoring our Single-Point-Of-Failure DB",
}, },
], ],
// Chat room - https://www.youtube.com/watch?v=ZfkwW4GgAiU // Camgirl room - https://www.youtube.com/watch?v=ZfkwW4GgAiU
'!wQqrqwOipOOWALxJNe:matrix.org': [ '!wQqrqwOipOOWALxJNe:matrix.org': [
{ {
id: "youtube", id: "youtube",
@ -70,6 +70,14 @@ const roomWidgetConfig = {
name: "Tip Me!!! -- Send me cash $$$", name: "Tip Me!!! -- Send me cash $$$",
}, },
], ],
// Game room - !BLQjREzUgbtIsgrvRn:matrix.org
'!BLQjREzUgbtIsgrvRn:matrix.org': [
{
id: "etherpad",
url: "http://localhost:8000/etherpad.html",
name: "Etherpad",
},
],
}; };
module.exports = React.createClass({ module.exports = React.createClass({
@ -81,11 +89,27 @@ module.exports = React.createClass({
componentDidMount: function() { componentDidMount: function() {
}, },
initAppConfig: function(appConfig) {
console.log("App props: ", this.props);
appConfig = appConfig.map(
(app, index, arr) => {
switch(app.id) {
case 'etherpad':
app.url = app.url + '?userName=' + this.props.userId +
'&padId=' + this.props.room.roomId;
break;
}
return app;
});
return appConfig;
},
getInitialState: function() { getInitialState: function() {
for (const key in roomWidgetConfig) { for (const key in roomWidgetConfig) {
if(key == this.props.room.roomId) { if(key == this.props.room.roomId) {
return { return {
apps: roomWidgetConfig[key], apps: this.initAppConfig(roomWidgetConfig[key]),
}; };
} }
} }
@ -112,6 +136,8 @@ module.exports = React.createClass({
url={app.url} url={app.url}
name={app.name} name={app.name}
fullWdith={arr.length<2 ? true : false} fullWdith={arr.length<2 ? true : false}
roomId={this.props.roomId}
userId={this.props.userId}
/>); />);
return ( return (

View File

@ -116,7 +116,10 @@ module.exports = React.createClass({
let appsDrawer = null; let appsDrawer = null;
if(this.props.showApps) { if(this.props.showApps) {
appsDrawer = <AppsDrawer ref="appsDrawer" room={this.props.room} />; appsDrawer = <AppsDrawer ref="appsDrawer"
room={this.props.room}
userId={this.props.userId}
maxHeight={this.props.maxHeight}/>;
} }
return ( return (