1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-31 22:54:11 +00:00

fix list wiki department permission (#6301)

This commit is contained in:
Michael An
2024-07-05 15:30:12 +08:00
committed by GitHub
parent 9916ac43e1
commit 6e45dfba13
3 changed files with 29 additions and 16 deletions

View File

@@ -1,6 +1,6 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { gettext, username, canPublishRepo } from '../../utils/constants';
import { gettext, username, canPublishRepo, isPro } from '../../utils/constants';
import WikiCardGroup from './wiki-card-group';
import wikiAPI from '../../utils/wiki-api';
import { Utils } from '../../utils/utils';
@@ -8,6 +8,8 @@ import toaster from '../toast';
import './wiki-card-view.css';
const { multiTenancy, cloudMode } = window.app.pageOptions;
const propTypes = {
data: PropTypes.object.isRequired,
deleteWiki: PropTypes.func.isRequired,
@@ -22,10 +24,11 @@ class WikiCardView extends Component {
this.state = {
departmentMap: {},
};
this.isDepartment = isPro && multiTenancy && cloudMode;
}
componentDidMount() {
if (!canPublishRepo) return;
if (!canPublishRepo || !this.isDepartment) return;
let departmentMap = {};
wikiAPI.listWikiDepartments().then(res => {
res.data.forEach(item => departmentMap[item.id] = true);