summaryrefslogtreecommitdiff
path: root/src/server/api/common/read-notification.ts
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-10-16 11:38:09 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-10-16 11:38:09 +0900
commit9427a756c9e4a1d95210ccfca56fdb67d62183ec (patch)
tree667cf5f4d6ecf80d0e3a22c4085a410537d1dc9d /src/server/api/common/read-notification.ts
parentfix(package): update @types/node to version 10.12.0 (#2912) (diff)
downloadsharkey-9427a756c9e4a1d95210ccfca56fdb67d62183ec.tar.gz
sharkey-9427a756c9e4a1d95210ccfca56fdb67d62183ec.tar.bz2
sharkey-9427a756c9e4a1d95210ccfca56fdb67d62183ec.zip
Update mongodb
Diffstat (limited to 'src/server/api/common/read-notification.ts')
-rw-r--r--src/server/api/common/read-notification.ts7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/server/api/common/read-notification.ts b/src/server/api/common/read-notification.ts
index 2d58ada4ce..27d3f1be32 100644
--- a/src/server/api/common/read-notification.ts
+++ b/src/server/api/common/read-notification.ts
@@ -1,4 +1,5 @@
import * as mongo from 'mongodb';
+import isObjectId from '../../../misc/is-objectid';
import { default as Notification, INotification } from '../../../models/notification';
import { publishMainStream } from '../../../stream';
import Mute from '../../../models/mute';
@@ -12,17 +13,17 @@ export default (
message: string | string[] | INotification | INotification[] | mongo.ObjectID | mongo.ObjectID[]
) => new Promise<any>(async (resolve, reject) => {
- const userId = mongo.ObjectID.prototype.isPrototypeOf(user)
+ const userId = isObjectId(user)
? user
: new mongo.ObjectID(user);
const ids: mongo.ObjectID[] = Array.isArray(message)
- ? mongo.ObjectID.prototype.isPrototypeOf(message[0])
+ ? isObjectId(message[0])
? (message as mongo.ObjectID[])
: typeof message[0] === 'string'
? (message as string[]).map(m => new mongo.ObjectID(m))
: (message as INotification[]).map(m => m._id)
- : mongo.ObjectID.prototype.isPrototypeOf(message)
+ : isObjectId(message)
? [(message as mongo.ObjectID)]
: typeof message === 'string'
? [new mongo.ObjectID(message)]