diff --git a/frontend/src/components/dialog/add-wiki-dialog.js b/frontend/src/components/dialog/add-wiki-dialog.js index 8c994e6ec7..e37039a3e6 100644 --- a/frontend/src/components/dialog/add-wiki-dialog.js +++ b/frontend/src/components/dialog/add-wiki-dialog.js @@ -10,7 +10,7 @@ import { SeahubSelect } from '../common/select'; const propTypes = { toggleCancel: PropTypes.func.isRequired, addWiki: PropTypes.func.isRequired, - currentDeptEmail: PropTypes.string, + currentDeptID: PropTypes.string, }; class AddWikiDialog extends React.Component { @@ -41,8 +41,8 @@ class AddWikiDialog extends React.Component { options.push(obj); } this.setState({ options }); - if (this.props.currentDeptEmail) { - const selectedOption = options.find(op => op.email == this.props.currentDeptEmail); + if (this.props.currentDeptID) { + const selectedOption = options.find(op => op.id == this.props.currentDeptID); this.setState({ selectedOption }); } }).catch(error => { diff --git a/frontend/src/components/wiki-card-view/wiki-card-view.js b/frontend/src/components/wiki-card-view/wiki-card-view.js index b7758faf99..3139c58076 100644 --- a/frontend/src/components/wiki-card-view/wiki-card-view.js +++ b/frontend/src/components/wiki-card-view/wiki-card-view.js @@ -105,24 +105,26 @@ class WikiCardView extends Component { toggelAddWikiDialog={null} /> ); - for (let deptID in groupWikis) { - groupWikis[deptID].wiki_info.length !== 0 && - wikiCardGroups.push( - - ); + for (let i = 0; i < groupWikis.length; i++) { + const groupWiki = groupWikis[i]; + if (groupWiki.wiki_info.length !== 0) { + wikiCardGroups.push( + + ); + } } wikiCardGroups.push( { + toggelAddWikiDialog = (currentDeptID) => { if (this.state.isShowAddDialog) { this.setState({ isShowAddDialog: false, - currentDeptEmail: '', + currentDeptID: '', }); } else { this.setState({ isShowAddDialog: true, - currentDeptEmail + currentDeptID }); } }; @@ -116,9 +116,8 @@ class Wikis extends Component { } this.setState({ wikis, - currentDeptEmail: '', - groupWikis, currentDeptID: '', + groupWikis, }); }).catch((error) => { if (error.response) { @@ -264,7 +263,7 @@ class Wikis extends Component { }