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

repair save-share-file-dialog bug (#3826)

* repair save-share-file-dialog bug

* repair click bug

* Remove extra code
This commit is contained in:
zxj96
2019-07-10 14:33:28 +08:00
committed by Daniel Pan
parent cfcb72a255
commit cb683d1e91
2 changed files with 13 additions and 6 deletions

View File

@@ -110,9 +110,9 @@ class FileChooser extends React.Component {
} }
} }
onCurrentRepoToggle = () => [ onCurrentRepoToggle = () => {
this.setState({isCurrentRepoShow: !this.state.isCurrentRepoShow}) this.setState({isCurrentRepoShow: !this.state.isCurrentRepoShow});
] }
onDirentItemClick = (repo, filePath, dirent) => { onDirentItemClick = (repo, filePath, dirent) => {
this.props.onDirentItemClick(repo, filePath, dirent); this.props.onDirentItemClick(repo, filePath, dirent);
@@ -310,7 +310,7 @@ class FileChooser extends React.Component {
selectedItemInfo: selectedItemInfo selectedItemInfo: selectedItemInfo
}); });
if (item.repo_id === this.props.repoID) { if (this.props.repoID && item.repo_id === this.props.repoID) {
seafileAPI.getRepoInfo(this.props.repoID).then(res => { seafileAPI.getRepoInfo(this.props.repoID).then(res => {
// need to optimized // need to optimized
let repoInfo = new RepoInfo(res.data); let repoInfo = new RepoInfo(res.data);

View File

@@ -36,7 +36,11 @@ class TreeViewItem extends React.Component {
onItemClick = (e) => { onItemClick = (e) => {
e.stopPropagation(); // need prevent event popup e.stopPropagation(); // need prevent event popup
let isCurrentRepo = this.props.selectedRepo.repo_id === this.props.repo.repo_id; let isCurrentRepo = false;
if (this.props.selectedRepo) {
isCurrentRepo = this.props.selectedRepo.repo_id === this.props.repo.repo_id;
}
if (isCurrentRepo) { if (isCurrentRepo) {
if (this.props.selectedPath !== this.state.filePath) { if (this.props.selectedPath !== this.state.filePath) {
this.props.onDirentItemClick(this.state.filePath, this.props.node.object); this.props.onDirentItemClick(this.state.filePath, this.props.node.object);
@@ -77,7 +81,10 @@ class TreeViewItem extends React.Component {
render() { render() {
let { node } = this.props; let { node } = this.props;
let isCurrentRepo = this.props.selectedRepo.repo_id === this.props.repo.repo_id; let isCurrentRepo = false;
if (this.props.selectedRepo) {
isCurrentRepo = this.props.selectedRepo.repo_id === this.props.repo.repo_id;
}
let isCurrentPath = this.props.selectedPath === this.state.filePath; let isCurrentPath = this.props.selectedPath === this.state.filePath;
const fileName = node.object.name; const fileName = node.object.name;