1
0
mirror of https://github.com/MisskeyIO/misskey synced 2024-12-27 04:58:40 +09:00
MisskeyIO/src/server/api/endpoints/i/read-all-messaging-messages.ts
2020-02-15 21:33:32 +09:00

32 lines
656 B
TypeScript

import { publishMainStream } from '../../../../services/stream';
import define from '../../define';
import { MessagingMessages } from '../../../../models';
export const meta = {
desc: {
'ja-JP': 'トークメッセージをすべて既読にします。',
'en-US': 'Mark all talk messages as read.'
},
tags: ['account', 'messaging'],
requireCredential: true as const,
kind: 'write:account',
params: {
}
};
export default define(meta, async (ps, user) => {
// Update documents
await MessagingMessages.update({
recipientId: user.id,
isRead: false
}, {
isRead: true
});
publishMainStream(user.id, 'readAllMessagingMessages');
});