Only display add app link if user has permission to add widgets in the room.
parent
ccf3c1de7a
commit
20a1693c71
|
@ -26,6 +26,7 @@ import SdkConfig from '../../../SdkConfig';
|
||||||
import ScalarAuthClient from '../../../ScalarAuthClient';
|
import ScalarAuthClient from '../../../ScalarAuthClient';
|
||||||
import ScalarMessaging from '../../../ScalarMessaging';
|
import ScalarMessaging from '../../../ScalarMessaging';
|
||||||
import { _t } from '../../../languageHandler';
|
import { _t } from '../../../languageHandler';
|
||||||
|
import WidgetUtils from '../../../WidgetUtils';
|
||||||
|
|
||||||
|
|
||||||
module.exports = React.createClass({
|
module.exports = React.createClass({
|
||||||
|
@ -147,6 +148,15 @@ module.exports = React.createClass({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_canUserModify: function() {
|
||||||
|
try {
|
||||||
|
return WidgetUtils.canUserModifyWidgets(this.props.room.roomId);
|
||||||
|
} catch(err) {
|
||||||
|
console.error(err);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
onClickAddWidget: function(e) {
|
onClickAddWidget: function(e) {
|
||||||
if (e) {
|
if (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
@ -176,7 +186,7 @@ module.exports = React.createClass({
|
||||||
/>);
|
/>);
|
||||||
});
|
});
|
||||||
|
|
||||||
const addWidget = this.state.apps && this.state.apps.length < 2 &&
|
const addWidget = this.state.apps && this.state.apps.length < 2 && this._canUserModify() &&
|
||||||
(<div onClick={this.onClickAddWidget}
|
(<div onClick={this.onClickAddWidget}
|
||||||
role="button"
|
role="button"
|
||||||
tabIndex="0"
|
tabIndex="0"
|
||||||
|
|
Loading…
Reference in New Issue