Răsfoiți Sursa

onClickNotificationElm -> onUnopenedNotificationOpend

Shun Miyazawa 2 ani în urmă
părinte
comite
8605174d73

+ 3 - 3
apps/app/src/components/InAppNotification/InAppNotificationElm.tsx

@@ -10,12 +10,12 @@ import { useModelNotification } from './PageNotification';
 
 interface Props {
   notification: IInAppNotification & HasObjectId
-  onClick?: () => void,
+  onUnopenedNotificationOpend?: () => void,
 }
 
 const InAppNotificationElm: FC<Props> = (props: Props) => {
 
-  const { notification, onClick } = props;
+  const { notification, onUnopenedNotificationOpend } = props;
 
   const modelNotificationUtils = useModelNotification(notification);
 
@@ -30,10 +30,10 @@ const InAppNotificationElm: FC<Props> = (props: Props) => {
     if (notification.status === InAppNotificationStatuses.STATUS_UNOPENED) {
       // set notification status "OPEND"
       await apiv3Post('/in-app-notification/open', { id: notification._id });
+      onUnopenedNotificationOpend?.();
     }
 
     publishOpen();
-    onClick?.();
   };
 
   const renderActionUserPictures = (): JSX.Element => {

+ 3 - 3
apps/app/src/components/InAppNotification/InAppNotificationList.tsx

@@ -9,11 +9,11 @@ import InAppNotificationElm from './InAppNotificationElm';
 
 type Props = {
   inAppNotificationData?: PaginateResult<IInAppNotification>,
-  onClickNotificationElm?: () => void,
+  onUnopenedNotificationOpend?: () => void,
 };
 
 const InAppNotificationList: FC<Props> = (props: Props) => {
-  const { inAppNotificationData, onClickNotificationElm } = props;
+  const { inAppNotificationData, onUnopenedNotificationOpend } = props;
 
   if (inAppNotificationData == null) {
     return (
@@ -34,7 +34,7 @@ const InAppNotificationList: FC<Props> = (props: Props) => {
           <InAppNotificationElm
             key={notification._id}
             notification={notification}
-            onClick={onClickNotificationElm}
+            onUnopenedNotificationOpend={onUnopenedNotificationOpend}
           />
         );
       }) }

+ 1 - 1
apps/app/src/components/Sidebar/InAppNotification/InAppNotificationSubstance.tsx

@@ -54,7 +54,7 @@ export const InAppNotificationContent = (props: InAppNotificationContentProps):
         : (
           <InAppNotificationList
             inAppNotificationData={inAppNotificationData}
-            onClickNotificationElm={mutateInAppNotificationData}
+            onUnopenedNotificationOpend={mutateInAppNotificationData}
           />
         )
       }