diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-09-08 20:49:53 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-09-08 20:49:53 +0900 |
| commit | e1aea70154545bcf398b138e5c651c240ee036c8 (patch) | |
| tree | 38ae532a144b636c056f1324555a3dddc77f2649 /src/api/serializers | |
| parent | Refactoring (diff) | |
| download | sharkey-e1aea70154545bcf398b138e5c651c240ee036c8.tar.gz sharkey-e1aea70154545bcf398b138e5c651c240ee036c8.tar.bz2 sharkey-e1aea70154545bcf398b138e5c651c240ee036c8.zip | |
Refactoring
Diffstat (limited to 'src/api/serializers')
| -rw-r--r-- | src/api/serializers/post.ts | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/api/serializers/post.ts b/src/api/serializers/post.ts index 86016d6696..df917a8595 100644 --- a/src/api/serializers/post.ts +++ b/src/api/serializers/post.ts @@ -33,12 +33,12 @@ const self = ( // Me const meId: mongo.ObjectID = me - ? mongo.ObjectID.prototype.isPrototypeOf(me) - ? me as mongo.ObjectID - : typeof me === 'string' - ? new mongo.ObjectID(me) - : (me as IUser)._id - : null; + ? mongo.ObjectID.prototype.isPrototypeOf(me) + ? me as mongo.ObjectID + : typeof me === 'string' + ? new mongo.ObjectID(me) + : (me as IUser)._id + : null; let _post: any; @@ -140,7 +140,10 @@ const self = ( }); if (vote != null) { - _post.poll.choices.filter(c => c.id == vote.choice)[0].is_voted = true; + const myChoice = _post.poll.choices + .filter(c => c.id == vote.choice)[0]; + + myChoice.is_voted = true; } } |