1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-02 07:27:04 +00:00

repair share btn control bug

This commit is contained in:
shanshuirenjia
2019-06-21 17:54:06 +08:00
parent 1b1df904f5
commit d5d6472186
10 changed files with 67 additions and 51 deletions

View File

@@ -25,7 +25,6 @@ const propTypes = {
isAllItemSelected: PropTypes.bool.isRequired,
isDirentListLoading: PropTypes.bool.isRequired,
direntList: PropTypes.array.isRequired,
showShareBtn: PropTypes.bool.isRequired,
sortBy: PropTypes.string.isRequired,
sortOrder: PropTypes.string.isRequired,
sortItems: PropTypes.func.isRequired,
@@ -468,13 +467,17 @@ class DirentListView extends React.Component {
let type = dirent.type;
let permission = dirent.permission;
let showShareBtn = Utils.isHasPermissionToShare(currentRepoInfo, permission, dirent);
let menuList = [];
let contextmenuList = [];
if (isContextmenu) {
let { SHARE, DOWNLOAD, DELETE } = TextTranslation;
contextmenuList = this.props.showShareBtn ? [SHARE] : [];
if (showShareBtn) {
contextmenuList = [SHARE];
}
if (dirent.permission === 'rw' || dirent.permission === 'r') {
contextmenuList = [...contextmenuList, DOWNLOAD];
@@ -485,14 +488,15 @@ class DirentListView extends React.Component {
}
contextmenuList = [...contextmenuList, 'Divider'];
}
let { RENAME, MOVE, COPY, PERMISSION, OPEN_VIA_CLIENT, LOCK, UNLOCK, COMMENT, HISTORY, ACCESS_LOG, TAGS } = TextTranslation;
if (type === 'dir' && permission === 'rw') {
if (can_set_folder_perm) {
menuList = [...menuList, RENAME, MOVE, COPY, 'Divider', PERMISSION, 'Divider', OPEN_VIA_CLIENT];
menuList = [...contextmenuList, RENAME, MOVE, COPY, 'Divider', PERMISSION, 'Divider', OPEN_VIA_CLIENT];
} else {
menuList = [...menuList, RENAME, MOVE, COPY, 'Divider', OPEN_VIA_CLIENT];
menuList = [...contextmenuList, RENAME, MOVE, COPY, 'Divider', OPEN_VIA_CLIENT];
}
return menuList;
}
@@ -659,7 +663,6 @@ class DirentListView extends React.Component {
repoEncrypted={this.repoEncrypted}
enableDirPrivateShare={this.props.enableDirPrivateShare}
isGroupOwnedRepo={this.props.isGroupOwnedRepo}
showShareBtn={this.props.showShareBtn}
onItemClick={this.props.onItemClick}
onItemRenameToggle={this.onItemRenameToggle}
onItemSelected={this.onItemSelected}