diff --git a/frontend/src/pages/lib-content-view/lib-content-view.js b/frontend/src/pages/lib-content-view/lib-content-view.js index 68bc24ddcc..c2d5310ec9 100644 --- a/frontend/src/pages/lib-content-view/lib-content-view.js +++ b/frontend/src/pages/lib-content-view/lib-content-view.js @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import cookie from 'react-cookies'; import moment from 'moment'; -import { gettext, siteRoot, username, canGenerateShareLink, canGenerateUploadLink } from '../../utils/constants'; +import { gettext, siteRoot, username, canGenerateShareLink, canGenerateUploadLink, isDocs } from '../../utils/constants'; import { seafileAPI } from '../../utils/seafile-api'; import { Utils } from '../../utils/utils'; import collabServer from '../../utils/collab-server'; @@ -236,11 +236,13 @@ class LibContentView extends React.Component { this.updateUsedRepoTags(); // list draft counts and revierw counts - seafileAPI.getRepoDraftCounts(repoID).then(res => { - this.setState({ - draftCounts: res.data.draft_counts, + if (isDocs) { + seafileAPI.getRepoDraftCounts(repoID).then(res => { + this.setState({ + draftCounts: res.data.draft_counts, + }); }); - }); + } if (Utils.isMarkdownFile(path)) { seafileAPI.getFileInfo(this.props.repoID, path).then(() => { diff --git a/frontend/src/repo-wiki-mode.js b/frontend/src/repo-wiki-mode.js index b0f7242a6f..65f543276e 100644 --- a/frontend/src/repo-wiki-mode.js +++ b/frontend/src/repo-wiki-mode.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import ReactDOM from 'react-dom'; import moment from 'moment'; -import { gettext, repoID, siteRoot, initialPath, isDir, canGenerateShareLink, canGenerateUploadLink, username } from './utils/constants'; +import { gettext, repoID, siteRoot, initialPath, isDir, canGenerateShareLink, canGenerateUploadLink, username, isDocs } from './utils/constants'; import { seafileAPI } from './utils/seafile-api'; import { Utils } from './utils/utils'; import collabServer from './utils/collab-server'; @@ -147,11 +147,13 @@ class Wiki extends Component { this.updateUsedRepoTags(); // list draft counts and revierw counts - seafileAPI.getRepoDraftCounts(repoID).then(res => { - this.setState({ - draftCounts: res.data.draft_counts, + if (isDocs) { + seafileAPI.getRepoDraftCounts(repoID).then(res => { + this.setState({ + draftCounts: res.data.draft_counts, + }); }); - }); + } // load side-panel data this.loadSidePanel(initialPath);