mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-25 14:50:29 +00:00
fix publish wiki (#7318)
* fix publish wiki * update --------- Co-authored-by: 孙永强 <11704063+s-yongqiang@user.noreply.gitee.com>
This commit is contained in:
@@ -97,10 +97,10 @@ class Wiki extends Component {
|
||||
|
||||
getWikiConfig = () => {
|
||||
let wikiAPIConfig;
|
||||
if (wikiPermission === 'rw') {
|
||||
wikiAPIConfig = wikiAPI.getWiki2Config(wikiId);
|
||||
} else {
|
||||
if (wikiPermission === 'public') {
|
||||
wikiAPIConfig = wikiAPI.getWiki2PublishConfig(wikiId);
|
||||
} else {
|
||||
wikiAPIConfig = wikiAPI.getWiki2Config(wikiId);
|
||||
}
|
||||
wikiAPIConfig.then(res => {
|
||||
const { wiki_config, repo_id, id: wikiRepoId } = res.data.wiki;
|
||||
@@ -200,10 +200,10 @@ class Wiki extends Component {
|
||||
isDataLoading: true,
|
||||
});
|
||||
let getWikiPage;
|
||||
if (wikiPermission === 'rw') {
|
||||
getWikiPage = wikiAPI.getWiki2Page(wikiId, pageId);
|
||||
} else {
|
||||
if (wikiPermission === 'public') {
|
||||
getWikiPage = wikiAPI.getWiki2PublishPage(wikiId, pageId);
|
||||
} else {
|
||||
getWikiPage = wikiAPI.getWiki2Page(wikiId, pageId);
|
||||
}
|
||||
getWikiPage.then(res => {
|
||||
const { permission, seadoc_access_token, assets_url } = res.data;
|
||||
|
@@ -20,7 +20,7 @@ import PublishedWikiExtrance from '../../components/published-wiki-entrance';
|
||||
|
||||
import './side-panel.css';
|
||||
|
||||
const { repoName } = window.wiki.config;
|
||||
const { repoName, publishUrl } = window.wiki.config;
|
||||
|
||||
const propTypes = {
|
||||
isSidePanelOpen: PropTypes.bool.isRequired,
|
||||
@@ -39,28 +39,10 @@ class SidePanel extends PureComponent {
|
||||
super(props);
|
||||
this.state = {
|
||||
isShowTrashDialog: false,
|
||||
customUrl: ''
|
||||
customUrl: publishUrl
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (wikiPermission == 'rw') {
|
||||
this.getPublishWikiLink();
|
||||
}
|
||||
}
|
||||
|
||||
getPublishWikiLink = () => {
|
||||
wikiAPI.getPublishWikiLink(wikiId).then((res) => {
|
||||
const { publish_url } = res.data;
|
||||
this.setState({
|
||||
customUrl: publish_url
|
||||
});
|
||||
}).catch((error) => {
|
||||
let errMessage = Utils.getErrorMsg(error);
|
||||
toaster.danger(errMessage);
|
||||
});
|
||||
};
|
||||
|
||||
onDeletePage = (pageId) => {
|
||||
const config = deepCopy(this.props.config);
|
||||
const { pages } = config;
|
||||
|
@@ -27,6 +27,7 @@
|
||||
isAdmin: {% if is_admin %} true {% else %} false {% endif %},
|
||||
initial_path: "{{ file_path|escapejs }}",
|
||||
isWiki2: true,
|
||||
publishUrl: "{{ publish_url }}",
|
||||
seadocServerUrl: "{{ seadoc_server_url }}",
|
||||
seadocAccessToken: "{{ seadoc_access_token }}",
|
||||
permission: "{{ permission }}",
|
||||
|
@@ -72,6 +72,11 @@ def wiki_view(request, wiki_id, page_id=None):
|
||||
|
||||
is_admin = is_repo_admin(username, repo_id)
|
||||
last_modified = datetime.fromtimestamp(last_modified)
|
||||
try:
|
||||
publish_config = Wiki2Publish.objects.get(repo_id=wiki.repo_id)
|
||||
publish_url = publish_config.publish_url
|
||||
except Wiki2Publish.DoesNotExist:
|
||||
publish_url = ''
|
||||
return render(request, "wiki/wiki_edit.html", {
|
||||
"wiki": wiki,
|
||||
"is_admin": is_admin,
|
||||
@@ -81,7 +86,8 @@ def wiki_view(request, wiki_id, page_id=None):
|
||||
"modify_time": last_modified,
|
||||
"seadoc_server_url": SEADOC_SERVER_URL,
|
||||
"permission": permission,
|
||||
"enable_user_clean_trash": config.ENABLE_USER_CLEAN_TRASH
|
||||
"enable_user_clean_trash": config.ENABLE_USER_CLEAN_TRASH,
|
||||
"publish_url": publish_url
|
||||
})
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user