mirror of
https://github.com/paricafe/misskey.git
synced 2025-01-11 11:20:50 -06:00
52774bbe64
* wip * wip * wip * Update index.ts * Update gen-openapi-spec.ts * Update api.ja-JP.md * Fix * Improve doc * Update gen-openapi-spec.ts * Update redoc.html * Improve doc * Update gen-openapi-spec.ts * Improve doc * Update CHANGELOG.md
44 lines
822 B
TypeScript
44 lines
822 B
TypeScript
import User from '../../../../models/user';
|
|
import { publishMainStream } from '../../../../services/stream';
|
|
import Message from '../../../../models/messaging-message';
|
|
import define from '../../define';
|
|
|
|
export const meta = {
|
|
desc: {
|
|
'ja-JP': 'トークメッセージをすべて既読にします。',
|
|
'en-US': 'Mark all talk messages as read.'
|
|
},
|
|
|
|
tags: ['account', 'messaging'],
|
|
|
|
requireCredential: true,
|
|
|
|
kind: 'account-write',
|
|
|
|
params: {
|
|
}
|
|
};
|
|
|
|
export default define(meta, async (ps, user) => {
|
|
// Update documents
|
|
await Message.update({
|
|
recipientId: user._id,
|
|
isRead: false
|
|
}, {
|
|
$set: {
|
|
isRead: true
|
|
}
|
|
}, {
|
|
multi: true
|
|
});
|
|
|
|
User.update({ _id: user._id }, {
|
|
$set: {
|
|
hasUnreadMessagingMessage: false
|
|
}
|
|
});
|
|
|
|
publishMainStream(user._id, 'readAllMessagingMessages');
|
|
|
|
return;
|
|
});
|