From b8e490d5946b422e313bb381305d57405c67a024 Mon Sep 17 00:00:00 2001 From: JoinTyang <41655440+JoinTyang@users.noreply.github.com> Date: Thu, 16 May 2024 09:58:18 +0800 Subject: [PATCH] fix edit wiki url (#6085) --- frontend/src/components/wiki-list-view/wiki-list-item.js | 2 +- frontend/src/pages/wiki2/index.js | 2 +- frontend/src/pages/wiki2/wiki-left-bar/wiki-left-bar.js | 2 +- seahub/urls.py | 4 ++-- seahub/wiki2/views.py | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/wiki-list-view/wiki-list-item.js b/frontend/src/components/wiki-list-view/wiki-list-item.js index 86cbd466ab..97e2466af2 100644 --- a/frontend/src/components/wiki-list-view/wiki-list-item.js +++ b/frontend/src/components/wiki-list-view/wiki-list-item.js @@ -72,7 +72,7 @@ class WikiListItem extends Component { let fileIconUrl = Utils.getDefaultLibIconUrl(false); let isOldVersion = wiki.version !== 'v2'; let publishedUrl = `${siteRoot}published/${encodeURIComponent(wiki.slug)}/`; - let editUrl = `${siteRoot}edit-wiki/${wiki.id}/`; + let editUrl = `${siteRoot}wikis/${wiki.id}/`; const desktopItem = ( { - return isEditWiki ? 'edit-wiki/' : 'published/'; + return isEditWiki ? 'wikis/' : 'published/'; }; getWikiConfig = () => { diff --git a/frontend/src/pages/wiki2/wiki-left-bar/wiki-left-bar.js b/frontend/src/pages/wiki2/wiki-left-bar/wiki-left-bar.js index ac655e4817..e2773eebba 100644 --- a/frontend/src/pages/wiki2/wiki-left-bar/wiki-left-bar.js +++ b/frontend/src/pages/wiki2/wiki-left-bar/wiki-left-bar.js @@ -22,7 +22,7 @@ export default class WikiLeftBar extends React.Component { } openPreviewApp = () => { - window.open(window.location.href.replace('/edit-wiki/', '/published/')); + window.open(window.location.href.replace('/wikis/', '/published/')); }; openAppSettingsDialog = () => { diff --git a/seahub/urls.py b/seahub/urls.py index 7dd2e5f3ce..21d1f15795 100644 --- a/seahub/urls.py +++ b/seahub/urls.py @@ -203,7 +203,7 @@ from seahub.ocm.settings import OCM_ENDPOINT from seahub.ai.apis import LibrarySdocIndexes, Search, LibrarySdocIndex, TaskStatus, \ LibraryIndexState, QuestionAnsweringSearchInLibrary, FileDownloadToken -from seahub.wiki2.views import edit_wiki +from seahub.wiki2.views import wiki_view from seahub.api2.endpoints.wiki2 import Wikis2View, Wiki2View, Wiki2ConfigView, Wiki2PagesDirView, Wiki2PageContentView urlpatterns = [ @@ -706,7 +706,7 @@ urlpatterns = [ re_path(r'^api/v2.1/admin/invitations/$', AdminInvitations.as_view(), name='api-v2.1-admin-invitations'), re_path(r'^api/v2.1/admin/invitations/(?P[a-f0-9]{32})/$', AdminInvitation.as_view(), name='api-v2.1-admin-invitation'), - re_path(r'^edit-wiki/(?P[^/]+)/(?P.*)$', edit_wiki, name='edit_wiki'), + re_path(r'^wikis/(?P[^/]+)/(?P.*)$', wiki_view, name='wiki'), path('avatar/', include('seahub.avatar.urls')), path('notice/', include('seahub.notifications.urls')), diff --git a/seahub/wiki2/views.py b/seahub/wiki2/views.py index 077924c9e2..e42464944a 100644 --- a/seahub/wiki2/views.py +++ b/seahub/wiki2/views.py @@ -24,7 +24,7 @@ logger = logging.getLogger(__name__) @login_required -def edit_wiki(request, wiki_id, file_path): +def wiki_view(request, wiki_id, file_path): """ edit wiki page. for wiki2 """ # get wiki object or 404