|
|
@@ -44,7 +44,7 @@ import DisplaySwitcher from '../components/Page/DisplaySwitcher';
|
|
|
import {
|
|
|
useCurrentUser, useCurrentPagePath,
|
|
|
useOwnerOfCurrentPage, useIsLatestRevision,
|
|
|
- useIsForbidden, useIsNotFound, useIsTrashPage, useShared, useShareLinkId, useIsSharedUser, useIsAbleToDeleteCompletely,
|
|
|
+ useIsForbidden, useIsNotFound, useIsNotCreatable, useIsTrashPage, useShared, useShareLinkId, useIsSharedUser, useIsAbleToDeleteCompletely,
|
|
|
useAppTitle, useSiteUrl, useConfidential, useIsEnabledStaleNotification,
|
|
|
useIsSearchServiceConfigured, useIsSearchServiceReachable, useIsMailerSetup,
|
|
|
useAclEnabled, useIsAclEnabled, useHasSlackConfig, useDrawioUri, useHackmdUri, useMathJax,
|
|
|
@@ -59,7 +59,9 @@ import {
|
|
|
|
|
|
|
|
|
const logger = loggerFactory('growi:pages:all');
|
|
|
-const { isPermalink: _isPermalink, isUsersHomePage, isTrashPage: _isTrashPage } = pagePathUtils;
|
|
|
+const {
|
|
|
+ isPermalink: _isPermalink, isUsersHomePage, isTrashPage: _isTrashPage, isCreatablePage,
|
|
|
+} = pagePathUtils;
|
|
|
const { removeHeadingSlash } = pathUtils;
|
|
|
|
|
|
|
|
|
@@ -83,6 +85,7 @@ type Props = CommonProps & {
|
|
|
isIdenticalPathPage?: boolean,
|
|
|
isForbidden: boolean,
|
|
|
isNotFound: boolean,
|
|
|
+ IsNotCreatable: boolean,
|
|
|
// isAbleToDeleteCompletely: boolean,
|
|
|
|
|
|
isSearchServiceConfigured: boolean,
|
|
|
@@ -142,6 +145,7 @@ const GrowiPage: NextPage<Props> = (props: Props) => {
|
|
|
// useOwnerOfCurrentPage(props.pageUser != null ? JSON.parse(props.pageUser) : null);
|
|
|
useIsForbidden(props.isForbidden);
|
|
|
useIsNotFound(props.isNotFound);
|
|
|
+ useIsNotCreatable(props.IsNotCreatable);
|
|
|
// useIsTrashPage(_isTrashPage(props.currentPagePath));
|
|
|
// useShared();
|
|
|
// useShareLinkId(props.shareLinkId);
|
|
|
@@ -346,6 +350,11 @@ async function injectRoutingInformation(context: GetServerSidePropsContext, prop
|
|
|
// check the page is forbidden or just does not exist.
|
|
|
const count = isPermalink ? await Page.count({ _id: pageId }) : await Page.count({ path: currentPathname });
|
|
|
props.isForbidden = count > 0;
|
|
|
+
|
|
|
+ if (!isCreatablePage(currentPathname)) {
|
|
|
+ props.IsNotCreatable = true;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
else {
|
|
|
// /62a88db47fed8b2d94f30000 ==> /path/to/page
|