WNomunomu 2 лет назад
Родитель
Сommit
c02893d4af

+ 1 - 17
apps/app/src/components/InAppNotification/PageNotification/PageModelNotification.tsx

@@ -3,7 +3,6 @@ import React, {
 } from 'react';
 } from 'react';
 
 
 import type { IPage, HasObjectId } from '@growi/core';
 import type { IPage, HasObjectId } from '@growi/core';
-import { useRouter } from 'next/router';
 
 
 import type { IInAppNotificationOpenable } from '~/client/interfaces/in-app-notification-openable';
 import type { IInAppNotificationOpenable } from '~/client/interfaces/in-app-notification-openable';
 import type { IInAppNotification } from '~/interfaces/in-app-notification';
 import type { IInAppNotification } from '~/interfaces/in-app-notification';
@@ -17,14 +16,12 @@ interface Props {
   notification: IInAppNotification<IPage> & HasObjectId
   notification: IInAppNotification<IPage> & HasObjectId
 }
 }
 
 
-const PageModelNotification: ForwardRefRenderFunction<IInAppNotificationOpenable, Props> = (props: Props, ref) => {
+const PageModelNotification: ForwardRefRenderFunction<IInAppNotificationOpenable, Props> = (props: Props) => {
 
 
   const { notification } = props;
   const { notification } = props;
 
 
   const { actionMsg, actionIcon } = useActionMsgAndIconForPageModelNotification(notification);
   const { actionMsg, actionIcon } = useActionMsgAndIconForPageModelNotification(notification);
 
 
-  const router = useRouter();
-
   const getActionUsers = useCallback(() => {
   const getActionUsers = useCallback(() => {
     const latestActionUsers = notification.actionUsers.slice(0, 3);
     const latestActionUsers = notification.actionUsers.slice(0, 3);
     const latestUsers = latestActionUsers.map((user) => {
     const latestUsers = latestActionUsers.map((user) => {
@@ -48,17 +45,6 @@ const PageModelNotification: ForwardRefRenderFunction<IInAppNotificationOpenable
 
 
   const actionUsers = getActionUsers();
   const actionUsers = getActionUsers();
 
 
-  // publish open()
-  const publishOpen = () => {
-    if (notification.target != null) {
-      // jump to target page
-      const targetPagePath = notification.target.path;
-      if (targetPagePath != null) {
-        router.push(targetPagePath);
-      }
-    }
-  };
-
   notification.parsedSnapshot = pageSerializers.parseSnapshot(notification.snapshot);
   notification.parsedSnapshot = pageSerializers.parseSnapshot(notification.snapshot);
 
 
   return (
   return (
@@ -67,8 +53,6 @@ const PageModelNotification: ForwardRefRenderFunction<IInAppNotificationOpenable
       actionMsg={actionMsg}
       actionMsg={actionMsg}
       actionIcon={actionIcon}
       actionIcon={actionIcon}
       actionUsers={actionUsers}
       actionUsers={actionUsers}
-      publishOpen={publishOpen}
-      ref={ref}
     />
     />
   );
   );
 };
 };

+ 1 - 11
apps/app/src/components/InAppNotification/PageNotification/UserModelNotification.tsx

@@ -3,7 +3,6 @@ import React, {
 } from 'react';
 } from 'react';
 
 
 import type { IUser, HasObjectId } from '@growi/core';
 import type { IUser, HasObjectId } from '@growi/core';
-import { useRouter } from 'next/router';
 
 
 import type { IInAppNotificationOpenable } from '~/client/interfaces/in-app-notification-openable';
 import type { IInAppNotificationOpenable } from '~/client/interfaces/in-app-notification-openable';
 import type { IInAppNotification } from '~/interfaces/in-app-notification';
 import type { IInAppNotification } from '~/interfaces/in-app-notification';
@@ -15,19 +14,12 @@ interface Props {
   notification: IInAppNotification<IUser> & HasObjectId
   notification: IInAppNotification<IUser> & HasObjectId
 }
 }
 
 
-const UserModelNotification: ForwardRefRenderFunction<IInAppNotificationOpenable, Props> = (props: Props, ref) => {
+const UserModelNotification: ForwardRefRenderFunction<IInAppNotificationOpenable, Props> = (props: Props) => {
 
 
   const { notification } = props;
   const { notification } = props;
 
 
   const { actionMsg, actionIcon } = useActionMsgAndIconForUserModelNotification(notification);
   const { actionMsg, actionIcon } = useActionMsgAndIconForUserModelNotification(notification);
 
 
-  const router = useRouter();
-
-  // publish open()
-  const publishOpen = () => {
-    router.push('/admin/users');
-  };
-
   const actionUsers = notification.target.username;
   const actionUsers = notification.target.username;
 
 
   return (
   return (
@@ -36,8 +28,6 @@ const UserModelNotification: ForwardRefRenderFunction<IInAppNotificationOpenable
       actionMsg={actionMsg}
       actionMsg={actionMsg}
       actionIcon={actionIcon}
       actionIcon={actionIcon}
       actionUsers={actionUsers}
       actionUsers={actionUsers}
-      publishOpen={publishOpen}
-      ref={ref}
     />
     />
   );
   );
 };
 };