1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-12-05 02:08:56 +09:00

Fix indantations

This commit is contained in:
syuilo 2017-03-20 19:10:13 +09:00
parent 1e2320a6e6
commit 29dd593fbe
2 changed files with 35 additions and 35 deletions

View File

@ -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;
}
});

View File

@ -18,42 +18,42 @@ export default function messagingStream(request: websocket.request, connection:
switch (msg.type) {
case 'read':
if (!msg.id) {
return;
if (!msg.id) {
return;
}
const id = new mongodb.ObjectID(msg.id);
// 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;
}
// Update documents
await Message.update({
_id: id
}, {
$set: { is_read: true }
});
if (message.is_read) {
return;
}
// 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;
}
});