|
|
@@ -1,6 +1,5 @@
|
|
|
import React, { ReactNode, useEffect } from 'react';
|
|
|
|
|
|
-
|
|
|
import EventEmitter from 'events';
|
|
|
|
|
|
import { isIPageInfoForEntity } from '@growi/core';
|
|
|
@@ -23,7 +22,7 @@ import superjson from 'superjson';
|
|
|
import { useCurrentGrowiLayoutFluidClassName, useEditorModeClassName } from '~/client/services/layout';
|
|
|
import { PageView } from '~/components/Page/PageView';
|
|
|
import { DrawioViewerScript } from '~/components/Script/DrawioViewerScript';
|
|
|
-import { SupportedAction } from '~/interfaces/activity';
|
|
|
+import { SupportedAction, SupportedActionType } from '~/interfaces/activity';
|
|
|
import type { CrowiRequest } from '~/interfaces/crowi-request';
|
|
|
import type { EditorConfig } from '~/interfaces/editor-settings';
|
|
|
import type { IPageGrantData } from '~/interfaces/page';
|
|
|
@@ -619,6 +618,22 @@ async function injectNextI18NextConfigurations(context: GetServerSidePropsContex
|
|
|
props._nextI18Next = nextI18NextConfig._nextI18Next;
|
|
|
}
|
|
|
|
|
|
+const getAction = (props: Props): SupportedActionType => {
|
|
|
+ if (props.isNotCreatable) {
|
|
|
+ return SupportedAction.ACTION_PAGE_NOT_CREATABLE;
|
|
|
+ }
|
|
|
+ if (props.isForbidden) {
|
|
|
+ return SupportedAction.ACTION_PAGE_FORBIDDEN;
|
|
|
+ }
|
|
|
+ if (props.isNotFound) {
|
|
|
+ return SupportedAction.ACTION_PAGE_NOT_FOUND;
|
|
|
+ }
|
|
|
+ if (pagePathUtils.isUsersHomepage(props.pageWithMeta?.data.path ?? '')) {
|
|
|
+ return SupportedAction.ACTION_PAGE_USER_HOME_VIEW;
|
|
|
+ }
|
|
|
+ return SupportedAction.ACTION_PAGE_VIEW;
|
|
|
+};
|
|
|
+
|
|
|
export const getServerSideProps: GetServerSideProps = async(context: GetServerSidePropsContext) => {
|
|
|
const req = context.req as CrowiRequest;
|
|
|
const { user } = req;
|
|
|
@@ -661,7 +676,8 @@ export const getServerSideProps: GetServerSideProps = async(context: GetServerSi
|
|
|
await injectRoutingInformation(context, props);
|
|
|
injectServerConfigurations(context, props);
|
|
|
await injectNextI18NextConfigurations(context, props, ['translation']);
|
|
|
- addActivity(context, SupportedAction.ACTION_PAGE_VIEW);
|
|
|
+
|
|
|
+ addActivity(context, getAction(props));
|
|
|
return {
|
|
|
props,
|
|
|
};
|