1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-03 07:55:36 +00:00

add check condition to send file info api

This commit is contained in:
LeoSirius
2019-07-05 15:28:13 +08:00
committed by llj
parent b64c38bad7
commit e19696e63c

View File

@@ -41,6 +41,7 @@ class GenerateShareLink extends React.Component {
'can_download': true
};
this.isExpireDaysNoLimit = (parseInt(shareLinkExpireDaysMin) === 0 && parseInt(shareLinkExpireDaysMax) === 0);
this.isOfficeFile = Utils.isOfficeFile(this.props.itemPath);
}
componentDidMount() {
@@ -57,12 +58,13 @@ class GenerateShareLink extends React.Component {
this.setState({isLoading: false});
}
});
seafileAPI.getFileInfo(repoID, path).then((res) => {
if (res.data) {
this.setState({fileInfo: res.data});
}
});
if (this.isOfficeFile) {
seafileAPI.getFileInfo(repoID, path).then((res) => {
if (res.data) {
this.setState({fileInfo: res.data});
}
});
}
}
onPasswordInputChecked = () => {
@@ -402,7 +404,7 @@ class GenerateShareLink extends React.Component {
<Input type="radio" name="radio1" onChange={() => this.setPermission('preview')} />{' '}{gettext('Preview only')}
</Label>
</FormGroup>
{(Utils.isOfficeFile(this.props.itemPath) && fileInfo && fileInfo.can_edit) &&
{(this.isOfficeFile && fileInfo && fileInfo.can_edit) &&
<FormGroup check className="permission">
<Label className="form-check-label">
<Input type="radio" name="radio1" onChange={() => this.setPermission('editOnCloudAndDownload')} />{' '}{gettext('Edit on cloud and download')}