add streaming events for renotemuting and blocking

This commit is contained in:
Chloe Kudryavtsev 2022-10-07 15:38:18 -04:00 committed by Gitea
parent 3d9df839a5
commit dd5100d124
6 changed files with 25 additions and 4 deletions

View file

@ -87,4 +87,6 @@ export default define(meta, paramDef, async (ps, user) => {
return await Users.pack(blockee.id, blocker, { return await Users.pack(blockee.id, blocker, {
detail: true, detail: true,
}); });
publishUserEvent(user.id, 'block', blockee);
}); });

View file

@ -83,4 +83,6 @@ export default define(meta, paramDef, async (ps, user) => {
return await Users.pack(blockee.id, blocker, { return await Users.pack(blockee.id, blocker, {
detail: true, detail: true,
}); });
publishUserEvent(user.id, 'unblock', blockee);
}); });

View file

@ -74,5 +74,5 @@ export default define(meta, paramDef, async (ps, user) => {
muteeId: mutee.id, muteeId: mutee.id,
} as RenoteMuting); } as RenoteMuting);
// publishUserEvent(user.id, 'mute', mutee); publishUserEvent(user.id, 'muteRenote', mutee);
}); });

View file

@ -69,5 +69,5 @@ export default define(meta, paramDef, async (ps, user) => {
id: exist.id, id: exist.id,
}); });
// publishUserEvent(user.id, 'unmute', mutee); publishUserEvent(user.id, 'unmuteRenote', mutee);
}); });

View file

@ -84,8 +84,21 @@ export default class Connection {
this.muting.delete(data.body.id); this.muting.delete(data.body.id);
break; break;
// TODO: renote mute events case 'block':
// TODO: block events this.blocking.add(data.body.id);
break;
case 'unblock':
this.blocking.delete(data.body.id);
break;
case 'muteRenote':
this.renoteMuting.add(data.body.id);
break;
case 'unmuteRenote':
this.renoteMuting.delete(data.body.id);
break;
case 'followChannel': case 'followChannel':
this.followingChannels.add(data.body.id); this.followingChannels.add(data.body.id);

View file

@ -44,6 +44,10 @@ export interface UserStreamTypes {
updateUserProfile: UserProfile; updateUserProfile: UserProfile;
mute: User; mute: User;
unmute: User; unmute: User;
muteRenote: User;
unmuteRenote: User;
block: User;
unblock: User;
follow: Packed<'UserDetailedNotMe'>; follow: Packed<'UserDetailedNotMe'>;
unfollow: Packed<'User'>; unfollow: Packed<'User'>;
userAdded: Packed<'User'>; userAdded: Packed<'User'>;