1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-19 18:29:23 +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

@@ -58,7 +58,6 @@ const propTypes = {
// list
isDirentListLoading: PropTypes.bool.isRequired,
direntList: PropTypes.array.isRequired,
showShareBtn: PropTypes.bool.isRequired,
sortBy: PropTypes.string.isRequired,
sortOrder: PropTypes.string.isRequired,
sortItems: PropTypes.func.isRequired,
@@ -203,7 +202,6 @@ class LibContentContainer extends React.Component {
updateUsedRepoTags={this.props.updateUsedRepoTags}
isDirentListLoading={this.props.isDirentListLoading}
direntList={this.props.direntList}
showShareBtn={this.props.showShareBtn}
sortBy={this.props.sortBy}
sortOrder={this.props.sortOrder}
sortItems={this.props.sortItems}
@@ -250,7 +248,6 @@ class LibContentContainer extends React.Component {
onItemCopy={this.props.onItemCopy}
updateDirent={this.props.updateDirent}
onAddFolder={this.props.onAddFolder}
showShareBtn={this.props.showShareBtn}
showDirentDetail={this.props.showDirentDetail}
onGridItemClick={this.onGridItemClick}
isDirentDetailShow={this.props.isDirentDetailShow}
@@ -295,7 +292,6 @@ class LibContentContainer extends React.Component {
updateUsedRepoTags={this.props.updateUsedRepoTags}
isDirentListLoading={this.props.isDirentListLoading}
direntList={this.props.direntList}
showShareBtn={this.props.showShareBtn}
sortBy={this.props.sortBy}
sortOrder={this.props.sortOrder}
sortItems={this.props.sortItems}

View File

@@ -1480,33 +1480,11 @@ class LibContentView extends React.Component {
return '';
}
let showShareBtn = false;
let enableDirPrivateShare = false;
let { currentRepoInfo, repoEncrypted, userPerm } = this.state;
let isAdmin = currentRepoInfo.is_admin;
let isVirtual = currentRepoInfo.is_virtual;
let { currentRepoInfo, userPerm } = this.state;
let showShareBtn = Utils.isHasPermissionToShare(currentRepoInfo, userPerm);
let isRepoOwner = currentRepoInfo.owner_email === username;
if (!repoEncrypted) {
let showGenerateShareLinkTab = false;
if (canGenerateShareLink && (userPerm == 'rw' || userPerm == 'r')) {
showGenerateShareLinkTab = true;
}
let showGenerateUploadLinkTab = false;
if (canGenerateUploadLink && (userPerm == 'rw')) {
showGenerateUploadLinkTab = true;
}
if (!isVirtual && (isRepoOwner || isAdmin)) {
enableDirPrivateShare = true;
}
if (showGenerateShareLinkTab || showGenerateUploadLinkTab || enableDirPrivateShare) {
showShareBtn = true;
}
}
let direntItemsList = this.state.direntList.filter((item, index) => {
return index < this.state.itemsShowLength;
});
@@ -1599,7 +1577,6 @@ class LibContentView extends React.Component {
updateUsedRepoTags={this.updateUsedRepoTags}
isDirentListLoading={this.state.isDirentListLoading}
direntList={direntItemsList}
showShareBtn={showShareBtn}
sortBy={this.state.sortBy}
sortOrder={this.state.sortOrder}
sortItems={this.sortItems}