Shun Miyazawa 3 лет назад
Родитель
Сommit
6d3124e5a3
1 измененных файлов с 12 добавлено и 3 удалено
  1. 12 3
      packages/app/src/pages/share/[[...path]].page.tsx

+ 12 - 3
packages/app/src/pages/share/[[...path]].page.tsx

@@ -10,7 +10,7 @@ import dynamic from 'next/dynamic';
 import { ShareLinkLayout } from '~/components/Layout/ShareLinkLayout';
 import GrowiContextualSubNavigation from '~/components/Navbar/GrowiContextualSubNavigation';
 import { Page } from '~/components/Page';
-import { SupportedAction } from '~/interfaces/activity';
+import { SupportedAction, SupportedActionType } from '~/interfaces/activity';
 import { CrowiRequest } from '~/interfaces/crowi-request';
 import { RendererConfig } from '~/interfaces/services/renderer';
 import { IShareLinkHasId } from '~/interfaces/share-link';
@@ -162,8 +162,17 @@ export const getServerSideProps: GetServerSideProps = async(context: GetServerSi
   // await injectUserUISettings(context, props);
   await injectNextI18NextConfigurations(context, props);
 
-  // eslint-disable-next-line max-len, no-nested-ternary
-  const action = props.isExpired ? SupportedAction.ACTION_SHARE_LINK_EXPIRED_PAGE_VIEW : props.shareLink == null ? SupportedAction.ACTION_SHARE_LINK_NOT_FOUND : SupportedAction.ACTION_SHARE_LINK_PAGE_VIEW;
+  let action: SupportedActionType;
+  if (props.isExpired) {
+    action = SupportedAction.ACTION_SHARE_LINK_EXPIRED_PAGE_VIEW;
+  }
+  else if (props.shareLink == null) {
+    action = SupportedAction.ACTION_SHARE_LINK_NOT_FOUND;
+  }
+  else {
+    action = SupportedAction.ACTION_SHARE_LINK_PAGE_VIEW;
+  }
+
   await addActivity(context, action);
 
   return {