mirror of
https://github.com/haiwen/seahub.git
synced 2025-07-14 15:35:35 +00:00
Merge pull request #5129 from haiwen/mv-cp-fixup
[move/copy dialog] bugfix for 'mv/cp to current folder'
This commit is contained in:
commit
b7ca40d729
@ -23,9 +23,9 @@ class CopyDirent extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
repo: null,
|
||||
selectedPath: '',
|
||||
errMessage: '',
|
||||
repo: { repo_id: this.props.repoID },
|
||||
selectedPath: this.props.path,
|
||||
errMessage: ''
|
||||
};
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ class CopyDirent extends React.Component {
|
||||
copyItem = () => {
|
||||
let { repo, repoID, selectedPath } = this.state;
|
||||
let direntPath = Utils.joinPath(this.props.path, this.props.dirent.name);
|
||||
let message = 'Invalid destination path';
|
||||
let message = gettext('Invalid destination path');
|
||||
|
||||
if (!repo || (repo.repo_id === repoID && selectedPath === '')) {
|
||||
this.setState({errMessage: message});
|
||||
@ -105,12 +105,6 @@ class CopyDirent extends React.Component {
|
||||
return;
|
||||
}
|
||||
|
||||
// copy the dirent to current path
|
||||
if (selectedPath && this.props.path === selectedPath && repo.repo_id === repoID) {
|
||||
this.setState({errMessage: message});
|
||||
return;
|
||||
}
|
||||
|
||||
// copy the dirent to it's child. eg: A/B -> A/B/C
|
||||
if ( selectedPath && selectedPath.length > direntPath.length && selectedPath.indexOf(direntPath) > -1) {
|
||||
message = gettext('Can not copy directory %(src)s to its subdirectory %(des)s');
|
||||
@ -132,7 +126,7 @@ class CopyDirent extends React.Component {
|
||||
this.setState({
|
||||
repo: repo,
|
||||
selectedPath: selectedPath,
|
||||
errMessage: '',
|
||||
errMessage: ''
|
||||
});
|
||||
}
|
||||
|
||||
@ -163,7 +157,7 @@ class CopyDirent extends React.Component {
|
||||
onRepoItemClick={this.onRepoItemClick}
|
||||
mode={mode}
|
||||
/>
|
||||
{this.state.errMessage && <Alert color="danger" style={{margin: '0.5rem'}}>{this.state.errMessage}</Alert>}
|
||||
{this.state.errMessage && <Alert color="danger" className="mt-2">{this.state.errMessage}</Alert>}
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
<Button color="secondary" onClick={this.toggle}>{gettext('Cancel')}</Button>
|
||||
|
@ -23,9 +23,9 @@ class MoveDirent extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
repo: null,
|
||||
selectedPath: '',
|
||||
errMessage: '',
|
||||
repo: { repo_id: this.props.repoID },
|
||||
selectedPath: this.props.path,
|
||||
errMessage: ''
|
||||
};
|
||||
}
|
||||
|
||||
@ -139,7 +139,7 @@ class MoveDirent extends React.Component {
|
||||
this.setState({
|
||||
repo: repo,
|
||||
selectedPath: selectedPath,
|
||||
errMessage: '',
|
||||
errMessage: ''
|
||||
});
|
||||
}
|
||||
|
||||
@ -177,7 +177,7 @@ class MoveDirent extends React.Component {
|
||||
onRepoItemClick={this.onRepoItemClick}
|
||||
mode={mode}
|
||||
/>
|
||||
{this.state.errMessage && <Alert color="danger" style={{margin: '0.5rem'}}>{this.state.errMessage}</Alert>}
|
||||
{this.state.errMessage && <Alert color="danger" className="mt-2">{this.state.errMessage}</Alert>}
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
<Button color="secondary" onClick={this.toggle}>{gettext('Cancel')}</Button>
|
||||
|
@ -54,7 +54,6 @@ class FileChooser extends React.Component {
|
||||
currentRepoInfo: repoInfo,
|
||||
selectedRepo: repoInfo
|
||||
});
|
||||
this.props.onRepoItemClick(repoInfo);
|
||||
}).catch(error => {
|
||||
let errMessage = Utils.getErrorMsg(error);
|
||||
toaster.danger(errMessage);
|
||||
|
Loading…
Reference in New Issue
Block a user