AppsDrawer: Only append queryParams once

pull/21833/head
Robert Swain 2017-06-14 13:26:43 +02:00
parent 880e7149f3
commit 9c8ab2691b
1 changed files with 17 additions and 12 deletions

View File

@ -50,13 +50,12 @@ module.exports = React.createClass({
switch(app.type) { switch(app.type) {
case 'etherpad': case 'etherpad':
app.url = app.url + '?userName=' + this.props.userId + app.queryParams = '?userName=' + this.props.userId +
'&padId=' + this.props.room.roomId; '&padId=' + this.props.room.roomId;
break; break;
case 'jitsi': { case 'jitsi': {
const user = MatrixClientPeg.get().getUser(this.props.userId); const user = MatrixClientPeg.get().getUser(this.props.userId);
app.url = app.url + app.queryParams = '?confId=' + app.data.confId +
'?confId=' + app.data.confId +
'&displayName=' + encodeURIComponent(user.displayName) + '&displayName=' + encodeURIComponent(user.displayName) +
'&avatarUrl=' + encodeURIComponent(MatrixClientPeg.get().mxcUrlToHttp(user.avatarUrl)) + '&avatarUrl=' + encodeURIComponent(MatrixClientPeg.get().mxcUrlToHttp(user.avatarUrl)) +
'&email=' + encodeURIComponent(this.props.userId) + '&email=' + encodeURIComponent(this.props.userId) +
@ -181,15 +180,21 @@ module.exports = React.createClass({
render: function() { render: function() {
const apps = this.state.apps.map( const apps = this.state.apps.map(
(app, index, arr) => <AppTile (app, index, arr) => {
key={app.name} let appUrl = app.url;
id={app.id} if (app.queryParams) {
url={app.url} appUrl += app.queryParams;
name={app.name} }
fullWidth={arr.length<2 ? true : false} return <AppTile
room={this.props.room} key={app.name}
userId={this.props.userId} id={app.id}
/>); url={appUrl}
name={app.name}
fullWidth={arr.length<2 ? true : false}
room={this.props.room}
userId={this.props.userId}
/>;
});
const addWidget = this.state.apps && this.state.apps.length < 2 && const addWidget = this.state.apps && this.state.apps.length < 2 &&
(<div onClick={this.onClickAddWidget} (<div onClick={this.onClickAddWidget}