feat(streaming): Add emoji added event
This commit is contained in:
@@ -7,6 +7,7 @@ import { insertModerationLog } from '../../../../../services/insert-moderation-l
|
||||
import { ApiError } from '../../../error';
|
||||
import { ID } from '../../../../../misc/cafy-id';
|
||||
import rndstr from 'rndstr';
|
||||
import { publishBroadcastStream } from '../../../../../services/stream';
|
||||
|
||||
export const meta = {
|
||||
desc: {
|
||||
@@ -53,6 +54,10 @@ export default define(meta, async (ps, me) => {
|
||||
|
||||
await getConnection().queryResultCache!.remove(['meta_emojis']);
|
||||
|
||||
publishBroadcastStream('emojiAdded', {
|
||||
emoji: await Emojis.pack(emoji.id)
|
||||
});
|
||||
|
||||
insertModerationLog(me, 'addEmoji', {
|
||||
emojiId: emoji.id
|
||||
});
|
||||
|
@@ -39,6 +39,10 @@ export default class Connection {
|
||||
|
||||
this.wsConnection.on('message', this.onWsConnectionMessage);
|
||||
|
||||
this.subscriber.on('broadcast', async ({ type, body }) => {
|
||||
this.onBroadcastMessage(type, body);
|
||||
});
|
||||
|
||||
if (this.user) {
|
||||
this.updateFollowing();
|
||||
this.followingClock = setInterval(this.updateFollowing, 5000);
|
||||
@@ -72,6 +76,11 @@ export default class Connection {
|
||||
}
|
||||
}
|
||||
|
||||
@autobind
|
||||
private onBroadcastMessage(type: string, body: any) {
|
||||
this.sendMessageToWs(type, body);
|
||||
}
|
||||
|
||||
/**
|
||||
* APIリクエスト要求時
|
||||
*/
|
||||
|
Reference in New Issue
Block a user