1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-20 02:48:51 +00:00

Fix create wiki with department owner name (#6400)

* 01 fix add wiki department id change to email

* 02 fix wiki with same name
This commit is contained in:
Michael An
2024-07-23 14:40:52 +08:00
committed by GitHub
parent cd5a9b824c
commit 0fd8c9275a
3 changed files with 17 additions and 16 deletions

View File

@@ -10,7 +10,7 @@ import { SeahubSelect } from '../common/select';
const propTypes = {
toggleCancel: PropTypes.func.isRequired,
addWiki: PropTypes.func.isRequired,
currentDeptID: PropTypes.string,
currentDeptEmail: PropTypes.string,
};
class AddWikiDialog extends React.Component {
@@ -36,12 +36,13 @@ class AddWikiDialog extends React.Component {
let obj = {};
obj.value = departments[i].name;
obj.id = departments[i].id;
obj.email = departments[i].email;
obj.label = departments[i].name;
options.push(obj);
}
this.setState({ options });
if (this.props.currentDeptID) {
const selectedOption = options.find(op => op.id == this.props.currentDeptID);
if (this.props.currentDeptEmail) {
const selectedOption = options.find(op => op.email == this.props.currentDeptEmail);
this.setState({ selectedOption });
}
}).catch(error => {

View File

@@ -83,19 +83,19 @@ class WikiCardView extends Component {
toggelAddWikiDialog={canPublishRepo ? toggelAddWikiDialog.bind(this, null) : null}
/>
);
for (let deptID in department2WikisMap) {
for (let deptEmail in department2WikisMap) {
wikiCardGroups.push(
<WikiCardGroup
key={'department-Wikis-' + deptID}
key={'department-Wikis-' + deptEmail}
deleteWiki={this.props.deleteWiki}
renameWiki={this.props.renameWiki}
sidePanelRate={sidePanelRate}
isSidePanelFolded={isSidePanelFolded}
wikis={department2WikisMap[deptID]}
title={department2WikisMap[deptID][0].owner_nickname}
wikis={department2WikisMap[deptEmail]}
title={department2WikisMap[deptEmail][0].owner_nickname}
isDepartment={true}
isShowAvatar={false}
toggelAddWikiDialog={(canPublishRepo && this.state.departmentMap[deptID]) ? toggelAddWikiDialog.bind(this, deptID) : null}
toggelAddWikiDialog={(canPublishRepo && this.state.departmentMap[deptEmail]) ? toggelAddWikiDialog.bind(this, deptEmail) : null}
/>
);
}