diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-10-16 11:38:09 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-10-16 11:38:09 +0900 |
| commit | 9427a756c9e4a1d95210ccfca56fdb67d62183ec (patch) | |
| tree | 667cf5f4d6ecf80d0e3a22c4085a410537d1dc9d /src/services/note | |
| parent | fix(package): update @types/node to version 10.12.0 (#2912) (diff) | |
| download | sharkey-9427a756c9e4a1d95210ccfca56fdb67d62183ec.tar.gz sharkey-9427a756c9e4a1d95210ccfca56fdb67d62183ec.tar.bz2 sharkey-9427a756c9e4a1d95210ccfca56fdb67d62183ec.zip | |
Update mongodb
Diffstat (limited to 'src/services/note')
| -rw-r--r-- | src/services/note/read.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/services/note/read.ts b/src/services/note/read.ts index caf5cf318f..f2c1213363 100644 --- a/src/services/note/read.ts +++ b/src/services/note/read.ts @@ -1,4 +1,5 @@ import * as mongo from 'mongodb'; +import isObjectId from '../../misc/is-objectid'; import { publishMainStream } from '../../stream'; import User from '../../models/user'; import NoteUnread from '../../models/note-unread'; @@ -11,11 +12,11 @@ export default ( note: string | mongo.ObjectID ) => new Promise<any>(async (resolve, reject) => { - const userId: mongo.ObjectID = mongo.ObjectID.prototype.isPrototypeOf(user) + const userId: mongo.ObjectID = isObjectId(user) ? user as mongo.ObjectID : new mongo.ObjectID(user); - const noteId: mongo.ObjectID = mongo.ObjectID.prototype.isPrototypeOf(note) + const noteId: mongo.ObjectID = isObjectId(note) ? note as mongo.ObjectID : new mongo.ObjectID(note); |