|
@@ -59,7 +59,7 @@ import {
|
|
|
useIsEnabledStaleNotification, useIsIdenticalPath,
|
|
useIsEnabledStaleNotification, useIsIdenticalPath,
|
|
|
useIsSearchServiceConfigured, useIsSearchServiceReachable, useDisableLinkSharing,
|
|
useIsSearchServiceConfigured, useIsSearchServiceReachable, useDisableLinkSharing,
|
|
|
useHackmdUri,
|
|
useHackmdUri,
|
|
|
- useIsAclEnabled, useIsUserPage, useIsNotCreatable,
|
|
|
|
|
|
|
+ useIsAclEnabled, useIsUserPage,
|
|
|
useCsrfToken, useIsSearchScopeChildrenAsDefault, useCurrentPageId, useCurrentPathname,
|
|
useCsrfToken, useIsSearchScopeChildrenAsDefault, useCurrentPageId, useCurrentPathname,
|
|
|
useIsSlackConfigured, useRendererConfig, useEditingMarkdown,
|
|
useIsSlackConfigured, useRendererConfig, useEditingMarkdown,
|
|
|
useEditorConfig, useIsAllReplyShown, useIsUploadableFile, useIsUploadableImage,
|
|
useEditorConfig, useIsAllReplyShown, useIsUploadableFile, useIsUploadableImage,
|
|
@@ -136,7 +136,7 @@ type Props = CommonProps & {
|
|
|
isIdenticalPathPage?: boolean,
|
|
isIdenticalPathPage?: boolean,
|
|
|
isForbidden: boolean,
|
|
isForbidden: boolean,
|
|
|
isNotFound: boolean,
|
|
isNotFound: boolean,
|
|
|
- IsNotCreatable: boolean,
|
|
|
|
|
|
|
+ IsNotCreatablePage: boolean,
|
|
|
// isAbleToDeleteCompletely: boolean,
|
|
// isAbleToDeleteCompletely: boolean,
|
|
|
|
|
|
|
|
isSearchServiceConfigured: boolean,
|
|
isSearchServiceConfigured: boolean,
|
|
@@ -196,7 +196,7 @@ const GrowiPage: NextPage<Props> = (props: Props) => {
|
|
|
// useOwnerOfCurrentPage(props.pageUser != null ? JSON.parse(props.pageUser) : null);
|
|
// useOwnerOfCurrentPage(props.pageUser != null ? JSON.parse(props.pageUser) : null);
|
|
|
useIsForbidden(props.isForbidden);
|
|
useIsForbidden(props.isForbidden);
|
|
|
useIsNotFound(props.isNotFound);
|
|
useIsNotFound(props.isNotFound);
|
|
|
- useIsNotCreatable(props.IsNotCreatable);
|
|
|
|
|
|
|
+ // useIsNotCreatable(props.IsNotCreatable);
|
|
|
useRedirectFrom(props.redirectFrom);
|
|
useRedirectFrom(props.redirectFrom);
|
|
|
// useShared();
|
|
// useShared();
|
|
|
// useShareLinkId(props.shareLinkId);
|
|
// useShareLinkId(props.shareLinkId);
|
|
@@ -242,7 +242,7 @@ const GrowiPage: NextPage<Props> = (props: Props) => {
|
|
|
useCurrentPageId(pageId);
|
|
useCurrentPageId(pageId);
|
|
|
useSWRxCurrentPage(undefined, pageWithMeta?.data); // store initial data
|
|
useSWRxCurrentPage(undefined, pageWithMeta?.data); // store initial data
|
|
|
useIsUserPage(isUserPage(pagePath));
|
|
useIsUserPage(isUserPage(pagePath));
|
|
|
- useIsNotCreatable(props.isForbidden || !isCreatablePage(pagePath)); // TODO: need to include props.isIdentical
|
|
|
|
|
|
|
+ // useIsNotCreatable(props.isForbidden || !isCreatablePage(pagePath)); // TODO: need to include props.isIdentical
|
|
|
useCurrentPagePath(pagePath);
|
|
useCurrentPagePath(pagePath);
|
|
|
useCurrentPathname(props.currentPathname);
|
|
useCurrentPathname(props.currentPathname);
|
|
|
useEditingMarkdown(pageWithMeta?.data.revision?.body);
|
|
useEditingMarkdown(pageWithMeta?.data.revision?.body);
|
|
@@ -310,8 +310,8 @@ const GrowiPage: NextPage<Props> = (props: Props) => {
|
|
|
<>
|
|
<>
|
|
|
<PageAlerts />
|
|
<PageAlerts />
|
|
|
{ props.isForbidden && <ForbiddenPage /> }
|
|
{ props.isForbidden && <ForbiddenPage /> }
|
|
|
- { props.IsNotCreatable && <NotCreatablePage />}
|
|
|
|
|
- { !props.isForbidden && !props.IsNotCreatable && <DisplaySwitcher />}
|
|
|
|
|
|
|
+ { props.IsNotCreatablePage && <NotCreatablePage />}
|
|
|
|
|
+ { !props.isForbidden && !props.IsNotCreatablePage && <DisplaySwitcher />}
|
|
|
{/* <DisplaySwitcher /> */}
|
|
{/* <DisplaySwitcher /> */}
|
|
|
{/* <PageStatusAlert /> */}
|
|
{/* <PageStatusAlert /> */}
|
|
|
</>
|
|
</>
|
|
@@ -434,7 +434,7 @@ async function injectRoutingInformation(context: GetServerSidePropsContext, prop
|
|
|
}
|
|
}
|
|
|
else if (page == null) {
|
|
else if (page == null) {
|
|
|
props.isNotFound = true;
|
|
props.isNotFound = true;
|
|
|
- props.IsNotCreatable = !isCreatablePage(currentPathname);
|
|
|
|
|
|
|
+ props.IsNotCreatablePage = !isCreatablePage(currentPathname);
|
|
|
// check the page is forbidden or just does not exist.
|
|
// check the page is forbidden or just does not exist.
|
|
|
const count = isPermalink ? await Page.count({ _id: pageId }) : await Page.count({ path: currentPathname });
|
|
const count = isPermalink ? await Page.count({ _id: pageId }) : await Page.count({ path: currentPathname });
|
|
|
props.isForbidden = count > 0;
|
|
props.isForbidden = count > 0;
|