fix (ui): hide UI elements whenever access is not set

This commit is contained in:
Mickael Kerjean 2021-09-16 22:56:46 +10:00
parent be54a23465
commit b154c559ff
4 changed files with 5 additions and 3 deletions

View file

@ -15,7 +15,7 @@ window.addEventListener("DOMContentLoaded", () => {
const $loader = document.querySelector("#n-lder");
function render(){
ReactDOM.render(<React.StrictMode><Router/></React.StrictMode>, document.querySelector("div[role='main']"));
ReactDOM.render(<Router/>, document.querySelector("div[role='main']"));
return Promise.resolve();
};
function waitFor(n){

View file

@ -280,7 +280,7 @@ export class FilesPage extends React.Component {
<NgIf cond={this.state.loading === true}>
<Loader/>
</NgIf>
<MobileFileUpload path={this.state.path} />
<MobileFileUpload path={this.state.path} accessRight={this.state.metadata || {}} />
</div>
</div>
<div className="upload-footer">

View file

@ -45,6 +45,8 @@ export class MobileFileUpload extends React.Component{
render(){
if(!window.CONFIG["upload_button"] && /(Android|iPad|iPhone)/.test(navigator.userAgent) === false){
return null;
} else if(this.props.accessRight.can_create_file === false || this.props.accessRight.can_create_directory === false) {
return null;
}
return (

View file

@ -130,7 +130,7 @@ export class Submenu extends React.Component {
<span>{ t("Download") }</span>
</ReactCSSTransitionGroup>
</NgIf>
<NgIf cond={this.props.selected.length > 0} type="inline" onMouseDown={this.onDelete.bind(this, this.props.selected)}>
<NgIf cond={this.props.selected.length > 0 && this.props.accessRight.can_delete !== false} type="inline" onMouseDown={this.onDelete.bind(this, this.props.selected)}>
<ReactCSSTransitionGroup transitionName="submenuwithSelection" transitionLeave={false} transitionEnter={false} transitionAppear={true} transitionAppearTimeout={10000}>
<span>{ t("Remove") }</span>
</ReactCSSTransitionGroup>