1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-30 21:50:59 +00:00

Merge pull request #3744 from haiwen/share-bug-repair-2

Share bug repair 2
This commit is contained in:
Daniel Pan 2019-06-27 14:06:52 +08:00 committed by GitHub
commit 920e24c0db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 6 deletions

View File

@ -277,11 +277,11 @@ class SharedRepoListItem extends React.Component {
if (this.props.libraryType && this.props.libraryType === 'public') { if (this.props.libraryType && this.props.libraryType === 'public') {
let isRepoOwner = this.props.repo.owner_email === username; let isRepoOwner = this.props.repo.owner_email === username;
if (isSystemStaff || isRepoOwner) { if (isSystemStaff || isRepoOwner) {
operations.push('unshare'); operations.push('Unshare');
} }
} else { } else {
// scene one: (share, delete, itemToggle and other operations); // scene one: (Share, Delete, itemToggle and other operations);
// scene two: (share, unshare), (share), (unshare) // scene two: (Share, Unshare), (Share), (Unshare)
operations = this.generatorOperations(); operations = this.generatorOperations();
} }
const shareOperation = <a href="#" className="op-icon sf2-icon-share" title={gettext('Share')} onClick={this.onItemShare}></a>; const shareOperation = <a href="#" className="op-icon sf2-icon-share" title={gettext('Share')} onClick={this.onItemShare}></a>;
@ -319,11 +319,11 @@ class SharedRepoListItem extends React.Component {
</Fragment> </Fragment>
); );
} }
if (operations.length == 1 && operations[0] === 'share') { if (operations.length == 1 && operations[0] === 'Share') {
return shareOperation; return shareOperation;
} }
if (operations.length == 1 && operations[0] === 'unshare') { if (operations.length == 1 && operations[0] === 'Unshare') {
return unshareOperation; return unshareOperation;
} }
} }

View File

@ -1484,7 +1484,11 @@ class LibContentView extends React.Component {
let { currentRepoInfo, userPerm } = this.state; let { currentRepoInfo, userPerm } = this.state;
let showShareBtn = Utils.isHasPermissionToShare(currentRepoInfo, userPerm); let showShareBtn = Utils.isHasPermissionToShare(currentRepoInfo, userPerm);
let isRepoOwner = currentRepoInfo.owner_email === username; let isRepoOwner = currentRepoInfo.owner_email === username;
let isVirtual = currentRepoInfo.is_virtual;
let isAdmin = currentRepoInfo.is_admin;
if (!isVirtual && (isRepoOwner || isAdmin)) {
enableDirPrivateShare = true;
}
let direntItemsList = this.state.direntList.filter((item, index) => { let direntItemsList = this.state.direntList.filter((item, index) => {
return index < this.state.itemsShowLength; return index < this.state.itemsShowLength;
}); });