1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-01 15:09:14 +00:00

Merge branch '7.0'

This commit is contained in:
lian
2020-01-06 16:25:55 +08:00
16 changed files with 118 additions and 1482 deletions

View File

@@ -1264,7 +1264,11 @@ class LibContentView extends React.Component {
let direntList = this.state.direntList.filter(item => {
return item.name !== name;
});
this.setState({ direntList: direntList });
// Recalculate the state of the selection
this.recaculateSelectedStateAfterDirentDeleted(name, direntList);
this.setState({direntList: direntList});
this.updateReadmeMarkdown(direntList);
} else if (Utils.isAncestorPath(direntPath, this.state.path)) {
// the deleted item is ancester of the current item
@@ -1283,6 +1287,10 @@ class LibContentView extends React.Component {
let direntList = this.state.direntList.filter(item => {
return item.name !== name;
});
// Recalculate the state of the selection
this.recaculateSelectedStateAfterDirentDeleted(name, direntList);
this.setState({direntList: direntList});
this.updateReadmeMarkdown(direntList);
}
@@ -1531,6 +1539,20 @@ class LibContentView extends React.Component {
});
}
recaculateSelectedStateAfterDirentDeleted = (name, newDirentList) => {
let selectedDirentList = this.state.selectedDirentList.slice(0);
if (selectedDirentList.length > 0) {
selectedDirentList = selectedDirentList.filter(item => {
return item.name !== name;
});
}
this.setState({
selectedDirentList: selectedDirentList,
isDirentSelected: selectedDirentList.length > 0,
isAllDirentSelected: selectedDirentList.length === newDirentList.length,
});
}
onLibDecryptDialog = () => {
this.setState({libNeedDecrypt: false});
this.loadDirData(this.state.path);