This commit is contained in:
syuilo 2017-08-30 17:45:23 +09:00
parent 44c5c5a3aa
commit cf23e7a6fd
3 changed files with 16 additions and 0 deletions

View file

@ -5,6 +5,7 @@ ChangeLog (Release Notes)
unreleased
----------
* New: 投稿のピン留め (#746)
* New: ホームストリームにメッセージを流すことでlast_used_atを更新できるようにする (#745)
* その他細かな修正
2508 (2017/08/30)

View file

@ -2,6 +2,7 @@ import * as websocket from 'websocket';
import * as redis from 'redis';
import * as debug from 'debug';
import User from '../models/user';
import serializePost from '../serializers/post';
const log = debug('misskey');
@ -35,6 +36,15 @@ export default function homeStream(request: websocket.request, connection: webso
const msg = JSON.parse(data.utf8Data);
switch (msg.type) {
case 'alive':
// Update lastUsedAt
User.update({ _id: user._id }, {
$set: {
last_used_at: new Date()
}
});
break;
case 'capture':
if (!msg.id) return;
const postId = msg.id;

View file

@ -12,6 +12,11 @@ class Connection extends Stream {
i: me.token
});
// 最終利用日時を更新するため定期的にaliveメッセージを送信
setInterval(() => {
this.send({ type: 'alive' });
}, 1000 * 60);
this.on('i_updated', me.update);
this.on('my_token_regenerated', () => {