1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-12 21:30:39 +00:00

change permission on share pop up (#4386)

* change permission on share pop up

* update

* add Utils.getShareLinkPermissionStr
This commit is contained in:
lian
2020-01-02 12:05:50 +08:00
committed by Daniel Pan
parent 71a988e116
commit b67033c73d
3 changed files with 66 additions and 22 deletions

View File

@@ -112,27 +112,13 @@ class Item extends Component {
let itemType = item.is_dir ? (item.path === '/' ? 'library' : 'dir') : 'file';
let permission = item.repo_folder_permission;
let permissionOptions = Utils.getShareLinkPermissionList(itemType, permission, item.path, item.can_edit);
let currentPermission = this.getCurrentPermission();
let currentPermission = Utils.getShareLinkPermissionStr(this.props.item.permissions);
this.setState({
permissionOptions: permissionOptions,
currentPermission: currentPermission
});
}
getCurrentPermission = () => {
const { can_edit, can_download } = this.props.item.permissions;
switch (`${can_edit} ${can_download}`) {
case 'false true':
return 'preview_download';
case 'false false':
return 'preview_only';
case 'true true':
return 'edit_download';
case 'true false':
return 'cloud_edit';
}
}
toggleOpMenu = () => {
this.setState({
isOpMenuOpen: !this.state.isOpMenuOpen