diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-03-20 19:10:13 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-03-20 19:10:13 +0900 |
| commit | 29dd593fbe581d873c1fdb4302cb3bc2c1f859a7 (patch) | |
| tree | 1ef898e0f3c2723bb377083759656dace170a32e /src/api | |
| parent | v1403 (diff) | |
| download | sharkey-29dd593fbe581d873c1fdb4302cb3bc2c1f859a7.tar.gz sharkey-29dd593fbe581d873c1fdb4302cb3bc2c1f859a7.tar.bz2 sharkey-29dd593fbe581d873c1fdb4302cb3bc2c1f859a7.zip | |
Fix indantations
Diffstat (limited to 'src/api')
| -rw-r--r-- | src/api/stream/home.ts | 8 | ||||
| -rw-r--r-- | src/api/stream/messaging.ts | 60 |
2 files changed, 34 insertions, 34 deletions
diff --git a/src/api/stream/home.ts b/src/api/stream/home.ts index 80bced8ac8..2ab8d3025b 100644 --- a/src/api/stream/home.ts +++ b/src/api/stream/home.ts @@ -36,10 +36,10 @@ export default function homeStream(request: websocket.request, connection: webso switch (msg.type) { case 'capture': - if (!msg.id) return; - const postId = msg.id; - log(`CAPTURE: ${postId} by @${user.username}`); - subscriber.subscribe(`misskey:post-stream:${postId}`); + if (!msg.id) return; + const postId = msg.id; + log(`CAPTURE: ${postId} by @${user.username}`); + subscriber.subscribe(`misskey:post-stream:${postId}`); break; } }); diff --git a/src/api/stream/messaging.ts b/src/api/stream/messaging.ts index 4ec139b82b..71bf7a34c6 100644 --- a/src/api/stream/messaging.ts +++ b/src/api/stream/messaging.ts @@ -18,42 +18,42 @@ export default function messagingStream(request: websocket.request, connection: switch (msg.type) { case 'read': - if (!msg.id) { - return; - } - - const id = new mongodb.ObjectID(msg.id); + if (!msg.id) { + return; + } - // Fetch message - // SELECT _id, user_id, is_read - const message = await Message.findOne({ - _id: id, - recipient_id: user._id - }, { - fields: { - _id: true, - user_id: true, - is_read: true - } - }); + const id = new mongodb.ObjectID(msg.id); - if (message == null) { - return; + // Fetch message + // SELECT _id, user_id, is_read + const message = await Message.findOne({ + _id: id, + recipient_id: user._id + }, { + fields: { + _id: true, + user_id: true, + is_read: true } + }); - if (message.is_read) { - return; - } + if (message == null) { + return; + } + + if (message.is_read) { + return; + } - // Update documents - await Message.update({ - _id: id - }, { - $set: { is_read: true } - }); + // Update documents + await Message.update({ + _id: id + }, { + $set: { is_read: true } + }); - // Publish event - publishMessagingStream(message.user_id, user._id, 'read', id.toString()); + // Publish event + publishMessagingStream(message.user_id, user._id, 'read', id.toString()); break; } }); |