mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-20 02:48:51 +00:00
add publish wiki config (#7205)
* add publish wiki config * update test * update can_create_wiki * update test --------- Co-authored-by: 孙永强 <11704063+s-yongqiang@user.noreply.gitee.com>
This commit is contained in:
@@ -3,7 +3,7 @@ import { Dropdown, DropdownToggle, DropdownMenu, DropdownItem } from 'reactstrap
|
||||
import PropTypes from 'prop-types';
|
||||
import dayjs from 'dayjs';
|
||||
import relativeTime from 'dayjs/plugin/relativeTime';
|
||||
import { siteRoot, gettext, username } from '../../utils/constants';
|
||||
import { siteRoot, gettext, username, canPublishWiki } from '../../utils/constants';
|
||||
import ModalPortal from '../modal-portal';
|
||||
import DeleteWikiDialog from '../dialog/delete-wiki-dialog';
|
||||
import RenameWikiDialog from '../dialog/rename-wiki-dialog';
|
||||
@@ -245,7 +245,7 @@ class WikiCardItem extends Component {
|
||||
<DropdownMenu right={true} className="dtable-dropdown-menu">
|
||||
{showRename &&
|
||||
<DropdownItem onClick={this.onRenameToggle}>{gettext('Rename')}</DropdownItem>}
|
||||
{showPublish &&
|
||||
{showPublish && canPublishWiki &&
|
||||
<DropdownItem onClick={this.onPublishToggle}>{gettext('Publish')}</DropdownItem>}
|
||||
{showShare &&
|
||||
<DropdownItem onClick={this.onShareToggle}>{gettext('Share')}</DropdownItem>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { gettext, username, canPublishRepo, isPro } from '../../utils/constants';
|
||||
import { gettext, username, canCreateWiki, isPro } from '../../utils/constants';
|
||||
import WikiCardGroup from './wiki-card-group';
|
||||
import wikiAPI from '../../utils/wiki-api';
|
||||
import { Utils } from '../../utils/utils';
|
||||
@@ -30,7 +30,7 @@ class WikiCardView extends Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (!canPublishRepo || !isPro) return;
|
||||
if (!canCreateWiki || !isPro) return;
|
||||
let departmentMap = {};
|
||||
wikiAPI.listWikiDepartments().then(res => {
|
||||
res.data.forEach(item => departmentMap[item.id] = true);
|
||||
@@ -88,7 +88,7 @@ class WikiCardView extends Component {
|
||||
title={gettext('My Wikis')}
|
||||
isDepartment={false}
|
||||
isShowAvatar={false}
|
||||
toggleAddWikiDialog={canPublishRepo ? toggleAddWikiDialog.bind(this, null) : null}
|
||||
toggleAddWikiDialog={canCreateWiki ? toggleAddWikiDialog.bind(this, null) : null}
|
||||
/>
|
||||
);
|
||||
wikiCardGroups.push(
|
||||
@@ -122,7 +122,7 @@ class WikiCardView extends Component {
|
||||
title={groupWiki.group_name}
|
||||
isDepartment={true}
|
||||
isShowAvatar={false}
|
||||
toggleAddWikiDialog={(canPublishRepo && this.state.departmentMap[groupWiki.group_id]) ? toggleAddWikiDialog.bind(this, groupWiki.group_id) : null}
|
||||
toggleAddWikiDialog={(canCreateWiki && this.state.departmentMap[groupWiki.group_id]) ? toggleAddWikiDialog.bind(this, groupWiki.group_id) : null}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user