1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-15 23:00:57 +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 'can_download': true
}; };
this.isExpireDaysNoLimit = (parseInt(shareLinkExpireDaysMin) === 0 && parseInt(shareLinkExpireDaysMax) === 0); this.isExpireDaysNoLimit = (parseInt(shareLinkExpireDaysMin) === 0 && parseInt(shareLinkExpireDaysMax) === 0);
this.isOfficeFile = Utils.isOfficeFile(this.props.itemPath);
} }
componentDidMount() { componentDidMount() {
@@ -57,12 +58,13 @@ class GenerateShareLink extends React.Component {
this.setState({isLoading: false}); this.setState({isLoading: false});
} }
}); });
if (this.isOfficeFile) {
seafileAPI.getFileInfo(repoID, path).then((res) => { seafileAPI.getFileInfo(repoID, path).then((res) => {
if (res.data) { if (res.data) {
this.setState({fileInfo: res.data}); this.setState({fileInfo: res.data});
} }
}); });
}
} }
onPasswordInputChecked = () => { onPasswordInputChecked = () => {
@@ -402,7 +404,7 @@ class GenerateShareLink extends React.Component {
<Input type="radio" name="radio1" onChange={() => this.setPermission('preview')} />{' '}{gettext('Preview only')} <Input type="radio" name="radio1" onChange={() => this.setPermission('preview')} />{' '}{gettext('Preview only')}
</Label> </Label>
</FormGroup> </FormGroup>
{(Utils.isOfficeFile(this.props.itemPath) && fileInfo && fileInfo.can_edit) && {(this.isOfficeFile && fileInfo && fileInfo.can_edit) &&
<FormGroup check className="permission"> <FormGroup check className="permission">
<Label className="form-check-label"> <Label className="form-check-label">
<Input type="radio" name="radio1" onChange={() => this.setPermission('editOnCloudAndDownload')} />{' '}{gettext('Edit on cloud and download')} <Input type="radio" name="radio1" onChange={() => this.setPermission('editOnCloudAndDownload')} />{' '}{gettext('Edit on cloud and download')}