Przeglądaj źródła

FB: using null check

kaori 4 lat temu
rodzic
commit
f14754d870

+ 2 - 2
packages/app/src/server/models/in-app-notification.ts

@@ -139,7 +139,7 @@ export default (crowi: Crowi) => {
 
     const inAppNotification = await InAppNotification.findOneAndUpdate(query, parameters, options);
 
-    if (inAppNotification) {
+    if (inAppNotification != null) {
       commentEvent.emit('update', inAppNotification.user);
     }
 
@@ -174,7 +174,7 @@ export default (crowi: Crowi) => {
     const options = { new: true };
 
     const inAppNotification = await InAppNotification.findOneAndUpdate(query, parameters, options);
-    if (inAppNotification) {
+    if (inAppNotification != null) {
       commentEvent.emit('update', inAppNotification.user);
     }
     return inAppNotification;