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

When canGenerateShareLink is equal to false delete share

This commit is contained in:
zxj96
2019-04-25 15:09:28 +08:00
parent be3f3093a8
commit 17dba3e3c7
6 changed files with 42 additions and 13 deletions

View File

@@ -2,7 +2,7 @@ import React, { Fragment } from 'react';
import PropTypes from 'prop-types';
import MD5 from 'MD5';
import { UncontrolledTooltip } from 'reactstrap';
import { gettext, siteRoot, mediaUrl, username } from '../../utils/constants';
import { gettext, siteRoot, mediaUrl, username, canGenerateShareLink } from '../../utils/constants';
import { Utils } from '../../utils/utils';
import { seafileAPI } from '../../utils/seafile-api';
import URLDecorator from '../../utils/url-decorator';
@@ -412,6 +412,20 @@ class DirentListItem extends React.Component {
if (currentRepoInfo.permission === 'cloud-edit' || currentRepoInfo.permission === 'preview') {
return '';
}
let isShowShareBtn = false;
if (canGenerateShareLink) {
isShowShareBtn = true;
} else {
if (this.props.showShareBtn) {
if (dirent.type === 'dir') {
isShowShareBtn = true;
} else {
isShowShareBtn = false;
}
}
}
return (
<Fragment>
@@ -423,7 +437,7 @@ class DirentListItem extends React.Component {
<li className="operation-group-item">
<i className="op-icon sf2-icon-download" title={gettext('Download')} onClick={this.onItemDownload}></i>
</li>
{this.props.showShareBtn &&
{this.props.showShareBtn && isShowShareBtn &&
<li className="operation-group-item">
<i className="op-icon sf2-icon-share" title={gettext('Share')} onClick={this.onItemShare}></i>
</li>
@@ -453,7 +467,7 @@ class DirentListItem extends React.Component {
<li className="operation-group-item">
<i className="op-icon sf2-icon-download" title={gettext('Download')} onClick={this.onItemDownload}></i>
</li>
{this.props.showShareBtn &&
{this.props.showShareBtn && isShowShareBtn &&
<li className="operation-group-item">
<i className="op-icon sf2-icon-share" title={gettext('Share')} onClick={this.onItemShare}></i>
</li>