1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-22 08:47:22 +00:00

Merge pull request #2694 from haiwen/bug-repair

repair bug
This commit is contained in:
Daniel Pan 2018-12-22 11:44:38 +08:00 committed by GitHub
commit 24ea04f506
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 9 deletions

View File

@ -279,12 +279,12 @@ class GenerateShareLink extends React.Component {
</FormGroup> </FormGroup>
<FormGroup check className="permission"> <FormGroup check className="permission">
<Label check> <Label check>
<Input type="radio" name="radio1" defaultChecked={true} onChange={this.setPermission('previewAndDownload')}/>{' '}{gettext('Preview and download')} <Input type="radio" name="radio1" defaultChecked={true} onChange={() => this.setPermission('previewAndDownload')}/>{' '}{gettext('Preview and download')}
</Label> </Label>
</FormGroup> </FormGroup>
<FormGroup check className="permission"> <FormGroup check className="permission">
<Label check> <Label check>
<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>
<Label className="err-message">{gettext(this.state.errorInfo)}</Label><br /> <Label className="err-message">{gettext(this.state.errorInfo)}</Label><br />

View File

@ -59,19 +59,19 @@ class MoveDirent extends React.Component {
direntPaths.push(path); direntPaths.push(path);
}); });
// copy dirents to one of them. eg: A/B, A/C -> A/B // move dirents to one of them. eg: A/B, A/C -> A/B
if (direntPaths.some(direntPath => { return direntPath === selectedPath;})) { if (direntPaths.some(direntPath => { return direntPath === selectedPath;})) {
this.setState({errMessage: message}); this.setState({errMessage: message});
return; return;
} }
// copy dirents to current path // move dirents to current path
if (selectedPath && selectedPath === this.props.path && (repo.repo_id === repoID)) { if (selectedPath && selectedPath === this.props.path && (repo.repo_id === repoID)) {
this.setState({errMessage: message}); this.setState({errMessage: message});
return; return;
} }
// copy dirents to one of their child. eg: A/B, A/D -> A/B/C // move dirents to one of their child. eg: A/B, A/D -> A/B/C
let moveDirentPath = ''; let moveDirentPath = '';
let isChildPath = direntPaths.some(direntPath => { let isChildPath = direntPaths.some(direntPath => {
let flag = selectedPath.length > direntPath.length && selectedPath.indexOf(direntPath) > -1; let flag = selectedPath.length > direntPath.length && selectedPath.indexOf(direntPath) > -1;

View File

@ -495,7 +495,7 @@ class DirView extends React.Component {
isDirentSelected={this.state.isDirentSelected} isDirentSelected={this.state.isDirentSelected}
isAllDirentSelected={this.state.isAllDirentSelected} isAllDirentSelected={this.state.isAllDirentSelected}
direntList={this.state.direntList} direntList={this.state.direntList}
selectedDirentList={this.state.direntList} selectedDirentList={this.state.selectedDirentList}
onItemClick={this.onItemClick} onItemClick={this.onItemClick}
onAddFile={this.onAddFile} onAddFile={this.onAddFile}
onAddFolder={this.onAddFolder} onAddFolder={this.onAddFolder}

View File

@ -287,8 +287,17 @@ class DirentListItem extends React.Component {
let url = URLDecorator.getUrl({type: 'draft_view', repoID: repoID, filePath: draft_file_Path, draftId: draftId}); let url = URLDecorator.getUrl({type: 'draft_view', repoID: repoID, filePath: draft_file_Path, draftId: draftId});
let newWindow = window.open('draft'); let newWindow = window.open('draft');
newWindow.location.href = url; newWindow.location.href = url;
}).catch(() => { }).catch((error) => {
toaster.danger('Create draft failed.'); if (error.response) {
let errMessage = 'Draft already exists.';
if (errMessage === error.response.data.error_msg) {
errMessage = gettext('Draft already exists.');
toaster.danger(errMessage);
}
} else {
let errMessage = gettext('Create draft failed.');
toaster.danger(errMessage);
}
}); });
this.onItemMenuHide(); this.onItemMenuHide();
} }

View File

@ -9,7 +9,7 @@ class Dirent {
this.type = json.type; this.type = json.type;
this.mtime = moment.unix(json.mtime).fromNow(); this.mtime = moment.unix(json.mtime).fromNow();
this.permission = json.permission; this.permission = json.permission;
this.isSelected = false; this.isSelected = false; // is check or not
if (json.type === 'file') { if (json.type === 'file') {
this.size = Utils.bytesToSize(json.size); this.size = Utils.bytesToSize(json.size);
this.starred = json.starred; this.starred = json.starred;