Explorar o código

FB: using null check

kaori %!s(int64=4) %!d(string=hai) anos
pai
achega
f14754d870
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      packages/app/src/server/models/in-app-notification.ts

+ 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;